svn commit: r223928 - head/usr.bin/calendar
Edwin Groothuis
edwin at FreeBSD.org
Mon Jul 11 08:24:37 UTC 2011
Author: edwin
Date: Mon Jul 11 08:24:36 2011
New Revision: 223928
URL: http://svn.freebsd.org/changeset/base/223928
Log:
Fix the interpreter for:
Jul/Sat+3 Every third saturday of July - Jul/Sat+3
which was able to be done via:
Jul/SatThird Every third saturday of July - Jul/SatThird
Add interpreters for:
SatFourth Every third saturday of each month - SatFourth
Sat+4 Every third saturday of each month - Sat+4
Sat Every saturday of each month - Sat
MFC after: 2 weeks
Modified:
head/usr.bin/calendar/parsedata.c
Modified: head/usr.bin/calendar/parsedata.c
==============================================================================
--- head/usr.bin/calendar/parsedata.c Mon Jul 11 08:23:59 2011 (r223927)
+++ head/usr.bin/calendar/parsedata.c Mon Jul 11 08:24:36 2011 (r223928)
@@ -548,6 +548,24 @@ parsedaymonth(char *date, int *yearp, in
continue;
}
+ /* Every so-manied dayofweek of every month of the year */
+ if (lflags == (F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) {
+ offset = indextooffset(modifierindex);
+
+ for (m = 0; m < 12; m++) {
+ dow = first_dayofweek_of_month(year, m);
+ d = (idayofweek - dow + 8) % 7;
+ d += (offset - 1) * 7;
+ if (remember_ymd(year, m, d)) {
+ remember(&remindex,
+ yearp, monthp, dayp, edp,
+ year, m, d, NULL);
+ continue;
+ }
+ }
+ continue;
+ }
+
/* A certain dayofweek of a month */
if (lflags ==
(F_MONTH | F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) {
@@ -918,6 +936,16 @@ indextooffset(char *s)
int i;
struct fixs *n;
+ if (s[0] == '+' || s[0] == '-') {
+ char ss[9];
+ for (i = -100; i < 100; i++) {
+ sprintf(ss, "%s%d", (i > 0) ? "+" : "", i);
+ if (strcmp(ss, s) == 0)
+ return (i);
+ }
+ return (0);
+ }
+
for (i = 0; i < 6; i++) {
if (strcasecmp(s, sequences[i]) == 0) {
if (i == 5)
More information about the svn-src-head
mailing list