Hi, for a while now, calendar(1) seems to have forgotten how to handle what the man page describes as: 'A month without a day matches the first of that month.' A notable result of this is, that the output of 'calendar -f /usr/share/calendar/calendar.all' is always headed by 'Unprocessed' error messages. The attached patch tries to help calendar(1) remember how to do this as is described in the man page. Since I'm not an avid calendar(1) user, I'd very much like others to review and try out the patch, before I go pester commiters by opening a PR. MfG CoCo --- src/usr.bin/calendar/parsedata.c.orig 2011-12-31 11:36:40.000000000 +0100 +++ src/usr.bin/calendar/parsedata.c 2011-12-31 11:57:55.000000000 +0100 _at__at_ -174,11 +174,22 _at__at_ } if (isonlydigits(date, 1)) { /* Assume month number only */ - *flags |= F_MONTH; + *flags |= (F_MONTH | F_DAYOFMONTH); + *idayofmonth = 1; *imonth = (int)strtol(date, (char **)NULL, 10); strcpy(month, getmonthname(*imonth)); return(1); } + if ((checkmonth(date, &len, &offset, &pmonth) != 0)) { + /* Assume month name only */ + *flags |= (F_MONTH | F_DAYOFMONTH); + *idayofmonth = 1; + *imonth = offset; + strcpy(month, getmonthname(*imonth)); + return(1); + } + + return (0); } }Received on Sat Dec 31 2011 - 11:00:40 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:22 UTC