Change calendar to report the actual date for variable day events.
E.g. for Easter, and entries like "04/SunFirst" calendar will now report: 04/05* Good Friday (2 days before easter) 04/07* First Sunday... instead of: Easter-2 Good Friday... 04/SunFirst First Sunday... I also modified the calendar files to use the variable day format for a lot of events so that they will be reported correctly. E.g. U.S. daylight savings time is now listed as: 04/SunFirst Daylight savings time... There are still a lot of wrong dates in there for some events that move from year to year, but I don't have a good calendar handy right now that I can use for reference.
This commit is contained in:
parent
baddaf9480
commit
544b5cb2f1
@ -47,7 +47,7 @@ int getfield __P((char *, char **, int *));
|
||||
int getmonth __P((char *));
|
||||
int geteaster __P((char *, int));
|
||||
int easter __P((int));
|
||||
int isnow __P((char *));
|
||||
int isnow __P((char *, int *, int *, int *));
|
||||
FILE *opencal __P((void));
|
||||
void settime __P((time_t));
|
||||
time_t Mktime __P((char *));
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Christian
|
||||
*
|
||||
* $Id: calendar.christian,v 1.2 1996/01/29 00:32:56 wosch Exp $
|
||||
* $Id: calendar.christian,v 1.3 1996/02/02 06:04:06 wosch Exp $
|
||||
*/
|
||||
|
||||
#ifndef _calendar_christian_
|
||||
@ -13,7 +13,7 @@ Easter-46 Ash Wednesday (First day of Lent)
|
||||
Easter-7 Palm Sunday (7 days before Easter)
|
||||
Easter-3 Maundy Thursday (3 days before Easter)
|
||||
Easter-2 Good Friday (2 days before Easter)
|
||||
Easter Easter Sunday
|
||||
Easter Easter Sunday
|
||||
Easter+39 Ascension Day (10 days before Pentecost)
|
||||
Easter+49 Pentecost (Whitsunday)
|
||||
Easter+50 Whitmonday
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Holiday
|
||||
*
|
||||
* $Id: calendar.holiday,v 1.2 1996/01/29 00:32:59 wosch Exp $
|
||||
* $Id: calendar.holiday,v 1.3 1996/01/31 13:40:39 mpp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _calendar_holiday_
|
||||
@ -32,11 +32,10 @@
|
||||
01/19 Nameday of Archbishop Makarios in Cyprus
|
||||
01/20 Army Day in Mali
|
||||
01/20 National Heroes Day in Guinea-Bissau
|
||||
01/20* Lee-Jackson Day in Virginia (3rd Monday)
|
||||
01/20* Martin Luther King Day in New York (3rd Sunday)
|
||||
01/20* Robert E. Lee's Birthday in Alabama & Mississippi (3rd Monday)
|
||||
01/SunThird Martin Luther King Day in New York (3rd Sunday)
|
||||
01/MonThird Robert E. Lee's Birthday in Alabama & Mississippi (3rd Monday)
|
||||
01/MonThird Lee-Jackson Day in Virginia (3rd Monday)
|
||||
01/21 Our Lady of Altagracia in Dominican Republic
|
||||
01/21* Lee-Jackson Day in Virginia (3rd Monday)
|
||||
01/23 Feast of St. Ildefonsus
|
||||
01/23 National Handwriting Day
|
||||
01/24 Economic Liberation Day in Togo
|
||||
@ -100,7 +99,7 @@
|
||||
03/25 Lady Day (a.k.a. the Feast of the Annunciation)
|
||||
03/25 Maryland Day in Maryland
|
||||
03/25 National Holiday in Greece
|
||||
03/25* Seward's Day in Alaska (last Monday)
|
||||
03/MonLast Seward's Day in Alaska (last Monday)
|
||||
03/26 Independence Day in Bangladesh
|
||||
03/26 Prince Jonah Kuhio Kalanianaole Day in Hawaii
|
||||
03/27 Armed Forces Day in Burma
|
||||
@ -124,7 +123,7 @@
|
||||
04/13 Songkron Day in Thailand
|
||||
04/14 Day of the Americas in Honduras
|
||||
04/15 Bengali New Year in Bangladesh
|
||||
04/15* Patriot's Day in Maine & Massachusetts (3rd Monday)
|
||||
04/MonThird Patriot's Day in Maine & Massachusetts (3rd Monday)
|
||||
04/16 De Diego's Birthday (celebrated in Puerto Rico)
|
||||
04/16 Holy Week (5 days) in Venezuela
|
||||
04/16 Tourist Week (5 days) in Uruguay
|
||||
@ -143,8 +142,8 @@
|
||||
04/26 Confederate Memorial Day in Florida & Georgia
|
||||
04/26 Union Day in Tanzania
|
||||
04/27 Independence Day in Togo
|
||||
04/28* Arbor Day in Wyoming (last Monday)
|
||||
04/28* Confederate Memorial Day in Alabama & Mississippi (last Monday)
|
||||
04/MonLast Arbor Day in Wyoming (last Monday)
|
||||
04/MonLast Confederate Memorial Day in Alabama & Mississippi (last Monday)
|
||||
04/30 The Workers Day in Uruguay
|
||||
05/01 Labor Day in many places
|
||||
05/01 Law Day (decl. by Eisenhower)
|
||||
@ -174,11 +173,10 @@
|
||||
05/18 Flag Day in Haiti
|
||||
05/18 Prayer Day in Denmark
|
||||
05/19 Youth and Sports Day in Turkey
|
||||
05/19* Memorial Day in Michigan (3rd Monday)
|
||||
05/MonThird Memorial Day in Michigan (3rd Monday)
|
||||
05/20 Mecklenburg Independence Day in North Carolina
|
||||
05/20 National Day in Cameroon
|
||||
05/20 Victoria Day in Canada
|
||||
05/20* Memorial Day in Michigan (3rd Monday)
|
||||
05/22 National Heroes Day in Sri Lanka
|
||||
05/23 Commonwealth Day in Jamaica, Belize
|
||||
05/23 National Labor Day in Jamaica
|
||||
@ -295,7 +293,7 @@
|
||||
08/15 Independence Day in India
|
||||
08/15 Liberation Day in South Korea
|
||||
08/15 National Day in Congo
|
||||
08/15* Admission Day in Hawaii, 1984 (3rd Friday)
|
||||
08/FriThird Admission Day in Hawaii, 1984 (3rd Friday)
|
||||
08/16 Bennington Battle Day in Vermont
|
||||
08/16 Independence Days (3 days) in Gabon
|
||||
08/16 Restoration Day in Dominican Republic
|
||||
@ -483,8 +481,8 @@
|
||||
05/25 Revolution in the Sudan in Libyan Arab Republic
|
||||
05/27 Afghanistan attains sovereignty, 1921
|
||||
06/02 Corpus Christi in Paraguay
|
||||
06/03 Jefferson Davis's Birthday in Alabama & Mississippi (1st Monday)
|
||||
06/03 Jefferson Davis's Birthday in Florida, Georgia, & S. Carolina
|
||||
06/MonFirst Jefferson Davis's Birthday in Alabama & Mississippi (1st Monday)
|
||||
06/MonFirst Jefferson Davis's Birthday in Florida, Georgia, & S. Carolina
|
||||
06/04 Queen's Birthday in New Zealand
|
||||
06/06 His Majesty, Yang Di-Pertuan Agong's Birthday in Malaysia
|
||||
06/11 Queen's Birthday
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* USA holiday
|
||||
*
|
||||
* $Id: calendar.usholiday,v 1.3 1996/01/28 22:58:07 wosch Exp $
|
||||
* $Id: calendar.usholiday,v 1.3 1996/01/29 00:33:01 wosch Exp $
|
||||
*/
|
||||
|
||||
#ifndef _calendar_usholiday_
|
||||
@ -11,29 +11,29 @@
|
||||
01/14 Julian Calendar New Year's Day
|
||||
02/02 Groundhog Day
|
||||
02/14 St. Valentine's Day
|
||||
02/20* President's Day (3rd Monday of February)
|
||||
02/MonThird President's Day (3rd Monday of February)
|
||||
03/05 Mother-in-Law Day
|
||||
03/17 St. Patrick's Day
|
||||
03/20* Vernal Equinox
|
||||
04/01 April Fool's Day
|
||||
04/15 Income Tax Day
|
||||
04/03* Daylight Savings Time begins; clocks move forward (1st Sunday of April)
|
||||
04/SunFirst Daylight Savings Time begins; clocks move forward (1st Sunday of April)
|
||||
04/28* Arbor Day (varies from state to state)
|
||||
05/14* Mother's Day (2nd Sunday of May)
|
||||
05/20* Armed Forces Day (3rd Saturday of May)
|
||||
05/29* Memorial Day (Last Monday of May)
|
||||
06/18* Father's Day (3rd Sunday of June)
|
||||
05/SunSecond Mother's Day (2nd Sunday of May)
|
||||
05/SatThird Armed Forces Day (3rd Saturday of May)
|
||||
05/MonLast Memorial Day (Last Monday of May)
|
||||
06/SunThird Father's Day (3rd Sunday of June)
|
||||
06/21* Summer Solstice
|
||||
07/04 Independence Day
|
||||
09/04* Labor Day (1st Monday of September)
|
||||
09/09* Grandparent's Day (2nd Sunday of September; varies from state to state)
|
||||
09/MonFirst Labor Day (1st Monday of September)
|
||||
09/SunSecond Grandparent's Day (2nd Sunday of September; varies from state to state)
|
||||
09/22* Autumnal Equinox
|
||||
10/09* Columbus Day (2nd Monday of October)
|
||||
10/29* Daylight Savings Time ends; clocks move back (Last Sunday in October)
|
||||
10/MonSecond Columbus Day (2nd Monday of October)
|
||||
10/SunLast Daylight Savings Time ends; clocks move back (Last Sunday in October)
|
||||
10/31 All Hallows Eve (Halloween)
|
||||
11/06* Election Day (1st Tuesday after 1st Monday for even years)
|
||||
11/05* Election Day (1st Tuesday after 1st Monday for even years)
|
||||
11/11 Veterans' Day
|
||||
11/23 Thanksgiving Day (4th Thursday in November)
|
||||
11/ThuFourth Thanksgiving Day (4th Thursday in November)
|
||||
12/21* Winter Solstice
|
||||
12/24 Christmas Eve
|
||||
12/25 Christmas
|
||||
|
@ -85,7 +85,7 @@ settime(now)
|
||||
}
|
||||
|
||||
/* convert Day[/Month][/Year] into unix time (since 1970)
|
||||
* Day: tow digits, Month: two digits, Year: digits
|
||||
* Day: two digits, Month: two digits, Year: digits
|
||||
*/
|
||||
time_t Mktime (date)
|
||||
char *date;
|
||||
@ -143,8 +143,11 @@ time_t Mktime (date)
|
||||
* along with the matched line.
|
||||
*/
|
||||
int
|
||||
isnow(endp)
|
||||
isnow(endp, monthp, dayp, varp)
|
||||
char *endp;
|
||||
int *monthp;
|
||||
int *dayp;
|
||||
int *varp;
|
||||
{
|
||||
int day, flags, month, v1, v2;
|
||||
|
||||
@ -207,6 +210,7 @@ isnow(endp)
|
||||
if (flags & F_ISMONTH) {
|
||||
day = v1;
|
||||
month = v2;
|
||||
*varp = 0;
|
||||
}
|
||||
|
||||
/* {Month} {Weekday,Day} ... */
|
||||
@ -215,6 +219,7 @@ isnow(endp)
|
||||
month = v1;
|
||||
/* if no recognizable day, assume the first */
|
||||
day = v2 ? v2 : 1;
|
||||
*varp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,6 +232,7 @@ isnow(endp)
|
||||
fprintf(stderr, "\nday: %d %s month %d\n", day, endp, month);
|
||||
#endif
|
||||
|
||||
*varp = 1;
|
||||
/* variable weekday, SundayLast, MondayFirst ... */
|
||||
if (day < 0 || day >= 10) {
|
||||
|
||||
@ -270,14 +276,25 @@ isnow(endp)
|
||||
/* wired */
|
||||
else {
|
||||
day = tp->tm_mday + (((day - 1) - tp->tm_wday + 7) % 7);
|
||||
*varp = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
fprintf(stderr, "day2: yday %d %d\n", day, tp->tm_yday);
|
||||
#endif
|
||||
if (!(flags & F_EASTER))
|
||||
if (!(flags & F_EASTER)) {
|
||||
*monthp = month;
|
||||
*dayp = day;
|
||||
day = cumdays[month] + day;
|
||||
}
|
||||
else {
|
||||
for (v1 = 0; day > cumdays[v1]; v1++)
|
||||
;
|
||||
*monthp = v1 - 1;
|
||||
*dayp = day - cumdays[v1 - 1] - 1;
|
||||
*varp = 1;
|
||||
}
|
||||
|
||||
/* if today or today + offset days */
|
||||
if (day >= tp->tm_yday - f_dayBefore &&
|
||||
|
@ -82,6 +82,9 @@ cal()
|
||||
register char *p;
|
||||
FILE *fp;
|
||||
int ch;
|
||||
int month;
|
||||
int day;
|
||||
int var;
|
||||
char buf[2048 + 1];
|
||||
|
||||
if ((fp = opencal()) == NULL)
|
||||
@ -93,10 +96,18 @@ cal()
|
||||
while ((ch = getchar()) != '\n' && ch != EOF);
|
||||
if (buf[0] == '\0')
|
||||
continue;
|
||||
if (buf[0] != '\t')
|
||||
printing = isnow(buf) ? 1 : 0;
|
||||
if (printing)
|
||||
(void)fprintf(fp, "%s\n", buf);
|
||||
if (buf[0] != '\t') {
|
||||
printing = isnow(buf, &month, &day, &var) ? 1 : 0;
|
||||
if ((p = strchr(buf, '\t')) == NULL)
|
||||
continue;
|
||||
if (p > buf && p[-1] == '*')
|
||||
var = 1;
|
||||
if (printing)
|
||||
(void)fprintf(fp, "%.2d/%.2d%c%s\n", month,
|
||||
day, var ? '*' : ' ', p);
|
||||
}
|
||||
else if (printing)
|
||||
fprintf(fp, "%s\n", buf);
|
||||
}
|
||||
closecal(fp);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user