Date: Tue, 21 Jan 1997 22:38:18 -0800 (PST) From: Bill <bill@duchess.wagill.com> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/2556: Patch for calendar.c Message-ID: <199701220638.WAA07611@duchess.wagill.com> Resent-Message-ID: <199701220640.WAA18293@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 2556 >Category: bin >Synopsis: Patch for calendar.c >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Jan 21 22:40:01 PST 1997 >Last-Modified: >Originator: Bill >Organization: >Release: FreeBSD 2.1-STABLE i386 >Environment: FreeBSD duchess.wagill.com 2.1.5-RELEASE FreeBSD 2.1.5-RELEASE #0: Sat Jan 18 00:23:49 PST 1997 root@duchess.wagill.com:/usr/src/sys/compile/DUCHESS i386 >Description: I have implemented a small patch to calendar.c to allow forcing printing of a blank line in the ouput of calendar when a '%' character is found in the beginning of a line in the calendar file. This blank line can separate groups of calendar entries, such as calendar entries from the stock BSD calendar files from entries in a personal calendar file. I wanted to make this (small and arguably insignificant) patch available, in case others were interested; if there is a (other) formal way to submit patches, please let me know. Here's the diff listing: --- calendar.c.BSD Tue Jan 21 22:08:19 1997 +++ calendar.c.NEW Tue Jan 21 22:18:26 1997 @@ -118,7 +118,7 @@ void cal() { - register int printing; + register int printing, skip; register char *p; FILE *fp; int ch; @@ -126,17 +126,26 @@ if ((fp = opencal()) == NULL) return; - for (printing = 0; fgets(buf, sizeof(buf), stdin) != NULL;) { + for (printing = 0, skip = 0; fgets(buf, sizeof(buf), stdin) != NULL;) { if ((p = strchr(buf, '\n')) != NULL) *p = '\0'; else while ((ch = getchar()) != '\n' && ch != EOF); if (buf[0] == '\0') continue; + if (buf[0] == '%') { + skip = 1; + continue; + } if (buf[0] != '\t') printing = isnow(buf) ? 1 : 0; - if (printing) + if (printing) { + if (skip) { + skip = 0; + (void)fprintf(fp, "\n"); + } (void)fprintf(fp, "%s\n", buf); + } } closecal(fp); } >How-To-Repeat: >Fix: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701220638.WAA07611>