Date: Tue, 23 Feb 2010 21:28:25 +0000 (UTC) From: Edwin Groothuis <edwin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r204262 - user/edwin/calendar Message-ID: <201002232128.o1NLSPST084647@svn.freebsd.org>
index | next in thread | raw e-mail
Author: edwin Date: Tue Feb 23 21:28:25 2010 New Revision: 204262 URL: http://svn.freebsd.org/changeset/base/204262 Log: Properly handle definitions in dayofmonth/month* format. (* means variable each year, which unless these calendar files are updated every year will be out of sync very fast) Modified: user/edwin/calendar/io.c user/edwin/calendar/parsedata.c Modified: user/edwin/calendar/io.c ============================================================================== --- user/edwin/calendar/io.c Tue Feb 23 21:26:05 2010 (r204261) +++ user/edwin/calendar/io.c Tue Feb 23 21:28:25 2010 (r204262) @@ -181,6 +181,13 @@ cal(void) extradata)) == 0) continue; *pp = p; + if (count < 0) { + /* Show error status based on return value */ + fprintf(stderr, "Ignored: %s\n", buf); + if (count == -1) + continue; + count = -count + 1; + } /* Find the last tab */ while (pp[1] == '\t') Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Tue Feb 23 21:26:05 2010 (r204261) +++ user/edwin/calendar/parsedata.c Tue Feb 23 21:28:25 2010 (r204262) @@ -374,6 +374,7 @@ parsedaymonth(char *date, int *yearp, in int idayofweek, imonth, idayofmonth, year, index; int d, m, dow, rm, rd, offset; char *ed; + int retvalsign = 1; static struct yearinfo *years, *yearinfo; @@ -458,6 +459,15 @@ parsedaymonth(char *date, int *yearp, in continue; } + /* XXX Same day every year, but variable */ + if (*flags == (F_MONTH | F_DAYOFMONTH | F_VARIABLE)) { + if (!remember_ymd(year, imonth, idayofmonth)) + continue; + remember(&index, yearp, monthp, dayp, edp, + year, imonth, idayofmonth, NULL); + continue; + } + /* Same day every month */ if (*flags == (F_ALLMONTH | F_DAYOFMONTH)) { for (m = 1; m <= 12; m++) { @@ -697,9 +707,13 @@ parsedaymonth(char *date, int *yearp, in debug_determinestyle(2, date, *flags, month, imonth, dayofmonth, idayofmonth, dayofweek, idayofweek, modifieroffset, modifierindex, specialday); + retvalsign = -1; } - return (index); + if (retvalsign == -1) + return (-index - 1); + else + return (index); } static char *help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002232128.o1NLSPST084647>
