Subject: bin/492:
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Herb Peyerl <Herb.Peyerl@sidney.novatel.ca>
List: netbsd-bugs
Date: 09/20/1994 11:20:07
>Number:         492
>Category:       bin
>Synopsis:       
>Confidential:   yes
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 20 11:20:03 1994
>Originator:     Herb Peyerl
>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."
>Release:        
>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 ----

>Audit-Trail:
>Unformatted: