NetBSD Problem Report #492

From gnats  Tue Sep 20 11:09:11 1994
Received: from sidney.novatel.ca (sidney.novatel.ca [198.161.64.17]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id LAA23995 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Tue, 20 Sep 1994 11:09:04 -0700
Message-Id: <199409161806.MAA01699@sidney.novatel.ca>
Date: Fri, 16 Sep 1994 12:06:55 -0600
From: Herb Peyerl <Herb.Peyerl@sidney.novatel.ca>
Reply-To: hpeyerl@sidney.novatel.ca
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject:
X-Send-Pr-Version: 3.2

>Number:         492
>Category:       bin
>Synopsis:       bogus parsing in 'calendar'.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 20 11:20:03 +0000 1994
>Closed-Date:    Sun Mar 26 04:00:07 +0000 1995
>Last-Modified:  Wed Jul 02 03:01:14 +0000 1997
>Originator:     Herb Peyerl
>Release:        
>Organization:
hpeyerl@novatel.ca                           |  NovAtel Communications Ltd.
hpeyerl@fsa.ca                               | <nothing I say matters anyway>
 "A sucking chest wound is nature's way of telling you to slow down."
>Environment:
NetBSD/i386

System: NetBSD sidney 1.0_BETA NetBSD 1.0_BETA (SIDNEY) #8: Wed Aug 31 09:05:39 MDT 1994 hpeyerl@sidney:/home/src/sys/arch/i386/compile/SIDNEY i386


>Description:
	There is an oddity in the "calendar" program whereby if you specify a
	verbal day (ie: "mon", "Tuesday", etc) at the beginning of the line
	in your calendar file and the next "field" starts with a number, it
	will interpret that as the number of a month.  The manpage states
	that the order should be "month then day" and if a "day" is specified
	first, it is taken to be that day every week. 

	also, I think there should be some way to specify where the calendar
	program is to find the users calendar file.  It looks in the current
	directory for a file called "calendar" which means I've always got to
	chdir to wherever I happen to store it.  So; I've modified it to
	chdir() to "$CALENDAR_DIR" environment variable to check the calendar
	file there.

>How-To-Repeat:
	The following line will be interpreted as "Every monday in August": 

mon    ...     8AM meeting w/Manufacturing. Darryl's office



>Fix:

The following patch to the 4.4Lite calendar.c.  4.4's calendar is identical
to our calendar except for some formatting changes. The last patch is the
fix. It simply removes the check for a month after the program has determined
that it has already found a "day".

*** calendar.c.orig     Tue Sep 20 09:38:59 1994
--- calendar.c  Fri Sep 16 11:46:11 1994
***************
*** 80,85 ****
--- 80,86 ----
  {
        extern int optind;
        int ch;
+       char *caldir;

        while ((ch = getopt(argc, argv, "-a")) != EOF)
                switch (ch) {
***************
*** 110,116 ****
                                cal();
                        (void)seteuid(0);
                }
!       else
                cal();
        exit(0);
  }
--- 111,120 ----
                                cal();
                        (void)seteuid(0);
                }
!       else if ((caldir=getenv("CALENDAR_DIR")) != NULL) {
!               if (!chdir(caldir))
!                       cal();
!       } else
                cal();
        exit(0);
  }
***************
*** 205,212 ****
        if (flags & F_ISDAY || v1 > 12) {
                /* found a day */
                day = v1;
-               /* if no recognizable month, assume just a day alone */
-               if (!(month = getfield(endp, &endp, &flags)))
                        month = tp->tm_mon + 1;
        } else if (flags & F_ISMONTH) {
                month = v1;
--- 209,214 ----

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: hpeyerl 
State-Changed-When: Sat Mar 25 20:00:07 PST 1995 
State-Changed-Why:  
Fixed by herb. 
>Unformatted:



 If you're goign to adjust the function (i.e. add an environment variable),
 the documentation should be updated, too.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.