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
@@ -174,11 +174,22 @@
                        }
                        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);
                }
        }
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to