From owner-freebsd-bugs Tue Jan 21 22:40:07 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id WAA18335 for bugs-outgoing; Tue, 21 Jan 1997 22:40:07 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id WAA18293; Tue, 21 Jan 1997 22:40:03 -0800 (PST) Resent-Date: Tue, 21 Jan 1997 22:40:03 -0800 (PST) Resent-Message-Id: <199701220640.WAA18293@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, bill@duchess.wagill.com Received: from duchess.wagill.com (duchess.wagill.com [198.182.208.147]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id WAA18162 for ; Tue, 21 Jan 1997 22:38:34 -0800 (PST) Received: (from bill@localhost) by duchess.wagill.com (8.7.5/8.7.3) id WAA07611; Tue, 21 Jan 1997 22:38:18 -0800 (PST) Message-Id: <199701220638.WAA07611@duchess.wagill.com> Date: Tue, 21 Jan 1997 22:38:18 -0800 (PST) From: Bill Reply-To: bill@duchess.wagill.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/2556: Patch for calendar.c Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >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: