summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2010-08-23 22:09:25 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2010-08-23 22:09:25 +0000
commitc542a3f449df7bee48f531073fad64849199531c (patch)
tree8f1dbe9d94194e413cd21ccb4322498c4db08586
parent16baa5ca51be9ca09bbfbf81a370c8b4564c6213 (diff)
Notes
-rw-r--r--usr.bin/calendar/Makefile6
-rw-r--r--usr.bin/calendar/calendar.186
-rw-r--r--usr.bin/calendar/calendar.c111
-rw-r--r--usr.bin/calendar/calendar.h182
-rw-r--r--usr.bin/calendar/calendars/calendar.australia74
-rw-r--r--usr.bin/calendar/calendars/calendar.dutch90
-rw-r--r--usr.bin/calendar/calendars/calendar.freebsd7
-rw-r--r--usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common19
-rw-r--r--usr.bin/calendar/day.c417
-rw-r--r--usr.bin/calendar/io.c382
-rw-r--r--usr.bin/calendar/ostern.c47
-rw-r--r--usr.bin/calendar/paskha.c44
-rw-r--r--usr.bin/calendar/pathnames.h6
13 files changed, 571 insertions, 900 deletions
diff --git a/usr.bin/calendar/Makefile b/usr.bin/calendar/Makefile
index 481713ac9931..e5d1c6a93ac2 100644
--- a/usr.bin/calendar/Makefile
+++ b/usr.bin/calendar/Makefile
@@ -2,13 +2,17 @@
# $FreeBSD$
PROG= calendar
-SRCS= calendar.c io.c day.c ostern.c paskha.c
+SRCS= calendar.c locale.c events.c dates.c parsedata.c io.c day.c \
+ ostern.c paskha.c pom.c sunpos.c
+LDADD= -lm
INTER= de_AT.ISO_8859-15 de_DE.ISO8859-1 fr_FR.ISO8859-1 \
hr_HR.ISO8859-2 hu_HU.ISO8859-2 ru_RU.KOI8-R uk_UA.KOI8-U
DE_LINKS= de_DE.ISO8859-15
FR_LINKS= fr_FR.ISO8859-15
TEXTMODE?= 444
+WARNS?= 7
+
beforeinstall:
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${TEXTMODE} \
${.CURDIR}/calendars/calendar.* ${DESTDIR}${SHAREDIR}/calendar
diff --git a/usr.bin/calendar/calendar.1 b/usr.bin/calendar/calendar.1
index 404f44c4adec..8f8fb5cbadc5 100644
--- a/usr.bin/calendar/calendar.1
+++ b/usr.bin/calendar/calendar.1
@@ -9,10 +9,6 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
@@ -54,6 +50,8 @@
.Ek
.Oc
.Op Fl W Ar num
+.Op Fl U Ar UTC-offset
+.Op Fl l Ar longitude
.Sh DESCRIPTION
The
.Nm
@@ -93,6 +91,12 @@ as the default calendar file.
.Sm on
.Xc
For test purposes only: set date directly to argument values.
+.It Fl l Ar longitude , Fl U Ar UTC-offset
+Only one is needed:
+Perform lunar and solar calculations from this longitude or from
+this UTC offset.
+If neither is specified, the calculations will be based on the
+difference between UTC time and localtime.
.It Fl W Ar num
Print lines from today and the next
.Ar num
@@ -103,12 +107,36 @@ Ignore weekends when calculating the number of days.
To handle calendars in your national code table you can specify
.Dq LANG=<locale_name>
in the calendar file as early as possible.
-To handle national Easter
-names in the calendars
-.Dq Easter=<national_name>
-(for Catholic Easter) or
-.Dq Paskha=<national_name>
-(for Orthodox Easter) can be used.
+.Pp
+To handle the local name of sequences, you can specify them as:
+.Dq SEQUENCE=<first> <second> <third> <fourth> <fifth> <last>
+in the calendar file as early as possible.
+.Pp
+The names of the following special days are recognized:
+.Bl -tag -width 123456789012345 -compact
+.It Easter
+Catholic Easter.
+.It Paskha
+Orthodox Easter.
+.It NewMoon
+The lunar New Moon.
+.It FullMoon
+The lunar Full Moon.
+.It MarEquinox
+The solar equinox in March.
+.It JunSolstice
+The solar solstice in June.
+.It SepEquinox
+The solar equinox in March.
+.It DecSolstice
+The solar solstice in December.
+.It ChineseNewYear
+The first day of the Chinese year.
+.El
+These names may be reassigned to their local names via an assignment
+like
+.Dq Easter=Pasen
+in the calendar file.
.Pp
Other lines should begin with a month and day.
They may be entered in almost any format, either numeric or as character
@@ -122,11 +150,11 @@ Two numbers default to the month followed by the day.
Lines with leading tabs default to the last entered date, allowing
multiple line specifications for a single date.
.Pp
-``Easter'', is Easter for this year, and may be followed by a positive
-or negative integer.
-.Pp
-``Paskha'', is Orthodox Easter for this year, and may be followed by a
-positive or negative integer.
+The names of the recognized special days may be followed by a
+positive or negative integer, like:
+.Dq Easter+3
+or
+.Dq Pashka-4 .
.Pp
Weekdays may be followed by ``-4'' ...\& ``+5'' (aliases for
last, first, second, third, fourth) for moving events like
@@ -191,7 +219,8 @@ calendar file to use if no calendar file exists in the current directory.
do not send mail if this file exists.
.El
.Pp
-The following default calendar files are provided:
+The following default calendar files are provided in
+.Pa /usr/share/calendars:
.Pp
.Bl -tag -width calendar.southafrica -compact
.It Pa calendar.all
@@ -208,6 +237,8 @@ so that roving holidays are set correctly for the current year.
Days of special significance to computer people.
.It Pa calendar.croatian
Calendar of events in Croatia.
+.It Pa calendar.dutch
+Calendar of events in the Netherlands.
.It Pa calendar.freebsd
Birthdays of
.Fx
@@ -259,7 +290,28 @@ A
.Nm
command appeared in
.At v7 .
+.Sh NOTES
+Chinese New Year is calculated at 120 degrees east of Greenwich,
+which roughly corresponds with the east coast of China.
+For people west of China, this might result that the start of Chinese
+New Year and the day of the related new moon might differ.
+.Pp
+The phases of the moon and the longitude of the sun are calculated
+against the local position which corresponds with 30 degrees times
+the time-difference towards Greenwich.
+.Pp
+The new and full moons are happening on the day indicated: They
+might happen in the time period in the early night or in the late
+evening.
+It doesn't indicate that they are starting in the night on that date.
+.Pp
+Because of minor differences between the output of the formulas
+used and other sources on the Internet, Druids and Werewolves should
+double-check the start and end time of solar and lunar events.
.Sh BUGS
The
.Nm
-utility does not handle Jewish holidays and moon phases.
+utility does not handle Jewish holidays.
+.Pp
+There is no possibility to properly specify the local position
+needed for solar and lunar calculations.
diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c
index d1bb74516d98..29ac1748ca05 100644
--- a/usr.bin/calendar/calendar.c
+++ b/usr.bin/calendar/calendar.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -52,30 +48,38 @@ __FBSDID("$FreeBSD$");
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <time.h>
#include <unistd.h>
-#include "pathnames.h"
#include "calendar.h"
+#define UTCOFFSET_NOTSET 100 /* Expected between -24 and +24 */
+#define LONGITUDE_NOTSET 1000 /* Expected between -360 and +360 */
+
struct passwd *pw;
int doall = 0;
+int debug = 0;
+char *DEBUG = NULL;
time_t f_time = 0;
-
-int f_dayAfter = 0; /* days after current date */
-int f_dayBefore = 0; /* days before current date */
-int Friday = 5; /* day before weekend */
+double UTCOffset = UTCOFFSET_NOTSET;
+int EastLongitude = LONGITUDE_NOTSET;
static void usage(void) __dead2;
int
main(int argc, char *argv[])
{
+ int f_dayAfter = 0; /* days after current date */
+ int f_dayBefore = 0; /* days before current date */
+ int Friday = 5; /* day before weekend */
+
int ch;
+ struct tm tp1, tp2;
(void)setlocale(LC_ALL, "");
- while ((ch = getopt(argc, argv, "-A:aB:F:f:t:W:")) != -1)
+ while ((ch = getopt(argc, argv, "-A:aB:dD:F:f:l:t:U:W:")) != -1)
switch (ch) {
case '-': /* backward contemptible */
case 'a':
@@ -90,14 +94,10 @@ main(int argc, char *argv[])
calendarFile = optarg;
break;
- case 't': /* other date, undocumented, for tests */
- f_time = Mktime(optarg);
- break;
-
case 'W': /* we don't need no steenking Fridays */
Friday = -1;
-
/* FALLTHROUGH */
+
case 'A': /* days after current date */
f_dayAfter = atoi(optarg);
break;
@@ -106,9 +106,25 @@ main(int argc, char *argv[])
f_dayBefore = atoi(optarg);
break;
- case 'F':
+ case 'F': /* Change the time: When does weekend start? */
Friday = atoi(optarg);
break;
+ case 'l': /* Change longitudal position */
+ EastLongitude = strtol(optarg, NULL, 10);
+ break;
+ case 'U': /* Change UTC offset */
+ UTCOffset = strtod(optarg, NULL);
+ break;
+
+ case 'd':
+ debug = 1;
+ break;
+ case 'D':
+ DEBUG = optarg;
+ break;
+ case 't': /* other date, undocumented, for tests */
+ f_time = Mktime(optarg);
+ break;
case '?':
default:
@@ -125,7 +141,60 @@ main(int argc, char *argv[])
if (f_time <= 0)
(void)time(&f_time);
- settime(f_time);
+ /* if not set, determine where I could be */
+ {
+ if (UTCOffset == UTCOFFSET_NOTSET &&
+ EastLongitude == LONGITUDE_NOTSET) {
+ /* Calculate on difference between here and UTC */
+ time_t t;
+ struct tm tm;
+ long utcoffset, hh, mm, ss;
+ double uo;
+
+ time(&t);
+ localtime_r(&t, &tm);
+ utcoffset = tm.tm_gmtoff;
+ /* seconds -> hh:mm:ss */
+ hh = utcoffset / SECSPERHOUR;
+ utcoffset %= SECSPERHOUR;
+ mm = utcoffset / SECSPERMINUTE;
+ utcoffset %= SECSPERMINUTE;
+ ss = utcoffset;
+
+ /* hh:mm:ss -> hh.mmss */
+ uo = mm + (100.0 * (ss / 60.0));
+ uo /= 60.0 / 100.0;
+ uo = hh + uo / 100;
+
+ UTCOffset = uo;
+ EastLongitude = UTCOffset * 15;
+ } else if (UTCOffset == UTCOFFSET_NOTSET) {
+ /* Base on information given */
+ UTCOffset = EastLongitude / 15;
+ } else if (EastLongitude == LONGITUDE_NOTSET) {
+ /* Base on information given */
+ EastLongitude = UTCOffset * 15;
+ }
+ }
+
+ settimes(f_time, f_dayBefore, f_dayAfter, Friday, &tp1, &tp2);
+ generatedates(&tp1, &tp2);
+
+ /*
+ * FROM now on, we are working in UTC.
+ * This will only affect moon and sun related events anyway.
+ */
+ if (setenv("TZ", "UTC", 1) != 0)
+ errx(1, "setenv: %s", strerror(errno));
+ tzset();
+
+ if (debug)
+ dumpdates();
+
+ if (DEBUG != NULL) {
+ dodebug(DEBUG);
+ exit(0);
+ }
if (doall)
while ((pw = getpwent()) != NULL) {
@@ -146,9 +215,11 @@ static void __dead2
usage(void)
{
- fprintf(stderr, "%s\n%s\n",
+ fprintf(stderr, "%s\n%s\n%s\n",
"usage: calendar [-a] [-A days] [-B days] [-F friday] "
"[-f calendarfile]",
- " [-t dd[.mm[.year]]] [-W days]");
+ " [-d] [-t dd[.mm[.year]]] [-W days]",
+ " [-U utcoffset] [-l longitude]"
+ );
exit(1);
}
diff --git a/usr.bin/calendar/calendar.h b/usr.bin/calendar/calendar.h
index ff67ca6289f5..634c2782a56e 100644
--- a/usr.bin/calendar/calendar.h
+++ b/usr.bin/calendar/calendar.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -36,43 +32,163 @@
#include <sys/types.h>
#include <sys/uio.h>
+#define SECSPERDAY (24 * 60 * 60)
+#define SECSPERHOUR (60 * 60)
+#define SECSPERMINUTE (60)
+#define MINSPERHOUR (60)
+#define HOURSPERDAY (24)
+#define FSECSPERDAY (24.0 * 60.0 * 60.0)
+#define FSECSPERHOUR (60.0 * 60.0)
+#define FSECSPERMINUTE (60.0)
+#define FMINSPERHOUR (60.0)
+#define FHOURSPERDAY (24.0)
+
+#define DAYSPERYEAR 365
+#define DAYSPERLEAPYEAR 366
+
+/* Not yet categorized */
+
extern struct passwd *pw;
extern int doall;
-extern struct iovec header[];
-extern struct tm *tp;
+extern time_t t1, t2;
extern const char *calendarFile;
-extern int *cumdays;
extern int yrdays;
-extern struct fixs neaster, npaskha;
-
-void cal(void);
-void closecal(FILE *);
-int getday(char *);
-int getdayvar(char *);
-int getfield(char *, char **, int *);
-int getmonth(char *);
-int geteaster(char *, int);
-int getpaskha(char *, int);
-int easter(int);
-int isnow(char *, int *, int *, int *);
-FILE *opencal(void);
-void settime(time_t);
-time_t Mktime(char *);
-void setnnames(void);
+extern struct fixs neaster, npaskha, ncny, nfullmoon, nnewmoon;
+extern struct fixs nmarequinox, nsepequinox, njunsolstice, ndecsolstice;
+extern double UTCOffset;
+extern int EastLongitude;
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
-/* some flags */
-#define F_ISMONTH 0x01 /* month (January ...) */
-#define F_ISDAY 0x02 /* day of week (Sun, Mon, ...) */
-#define F_ISDAYVAR 0x04 /* variables day of week, like SundayLast */
-#define F_EASTER 0x08 /* Easter or easter depending days */
+/* Flags to determine the returned values by determinestyle() in parsedata.c */
+#define F_NONE 0x00000
+#define F_MONTH 0x00001
+#define F_DAYOFWEEK 0x00002
+#define F_DAYOFMONTH 0x00004
+#define F_MODIFIERINDEX 0x00008
+#define F_MODIFIEROFFSET 0x00010
+#define F_SPECIALDAY 0x00020
+#define F_ALLMONTH 0x00040
+#define F_ALLDAY 0x00080
+#define F_VARIABLE 0x00100
+#define F_EASTER 0x00200
+#define F_CNY 0x00400
+#define F_PASKHA 0x00800
+#define F_NEWMOON 0x01000
+#define F_FULLMOON 0x02000
+#define F_MAREQUINOX 0x04000
+#define F_SEPEQUINOX 0x08000
+#define F_JUNSOLSTICE 0x10000
+#define F_DECSOLSTICE 0x20000
+
+#define STRING_EASTER "Easter"
+#define STRING_PASKHA "Paskha"
+#define STRING_CNY "ChineseNewYear"
+#define STRING_NEWMOON "NewMoon"
+#define STRING_FULLMOON "FullMoon"
+#define STRING_MAREQUINOX "MarEquinox"
+#define STRING_SEPEQUINOX "SepEquinox"
+#define STRING_JUNSOLSTICE "JunSolstice"
+#define STRING_DECSOLSTICE "DecSolstice"
-extern int f_dayAfter; /* days after current date */
-extern int f_dayBefore; /* days before current date */
-extern int Friday; /* day before weekend */
+#define MAXCOUNT 125 /* Random number of maximum number of
+ * repeats of an event. Should be 52
+ * (number of weeks per year), if you
+ * want to show two years then it
+ * should be 104. If you are seeing
+ * more than this you are using this
+ * program wrong.
+ */
+
+/*
+ * All the astronomical calculations are carried out for the meridian 120
+ * degrees east of Greenwich.
+ */
+#define UTCOFFSET_CNY 8.0
+
+extern int debug; /* show parsing of the input */
+extern int year1, year2;
+
+/* events.c */
+/*
+ * Event sorting related functions:
+ * - Use event_add() to create a new event
+ * - Use event_continue() to add more text to the last added event
+ * - Use event_print_all() to display them in time chronological order
+ */
+struct event *event_add(int, int, int, char *, int, char *, char *);
+void event_continue(struct event *events, char *txt);
+void event_print_all(FILE *fp);
+struct event {
+ int year;
+ int month;
+ int day;
+ int var;
+ char *date;
+ char *text;
+ char *extra;
+ struct event *next;
+};
+
+/* locale.c */
struct fixs {
char *name;
- int len;
+ size_t len;
};
+
+extern const char *days[];
+extern const char *fdays[];
+extern const char *fmonths[];
+extern const char *months[];
+extern const char *sequences[];
+extern struct fixs fndays[8]; /* full national days names */
+extern struct fixs fnmonths[13]; /* full national months names */
+extern struct fixs ndays[8]; /* short national days names */
+extern struct fixs nmonths[13]; /* short national month names */
+extern struct fixs nsequences[10];
+
+void setnnames(void);
+void setnsequences(char *);
+
+/* day.c */
+extern const struct tm tm0;
+extern char dayname[];
+void settimes(time_t,int before, int after, int friday, struct tm *tp1, struct tm *tp2);
+time_t Mktime(char *);
+
+/* parsedata.c */
+int parsedaymonth(char *, int *, int *, int *, int *, char **);
+void dodebug(char *type);
+
+/* io.c */
+void cal(void);
+void closecal(FILE *);
+FILE *opencal(void);
+
+/* ostern.c / pashka.c */
+int paskha(int);
+int easter(int);
+
+/* dates.c */
+extern int cumdaytab[][14];
+extern int mondaytab[][14];
+extern int debug_remember;
+void generatedates(struct tm *tp1, struct tm *tp2);
+void dumpdates(void);
+int remember_ymd(int y, int m, int d);
+int remember_yd(int y, int d, int *rm, int *rd);
+int first_dayofweek_of_year(int y);
+int first_dayofweek_of_month(int y, int m);
+int walkthrough_dates(struct event **e);
+void addtodate(struct event *e, int year, int month, int day);
+
+/* pom.c */
+#define MAXMOONS 18
+void pom(int year, double UTCoffset, int *fms, int *nms);
+void fpom(int year, double utcoffset, double *ffms, double *fnms);
+
+/* sunpos.c */
+void equinoxsolstice(int year, double UTCoffset, int *equinoxdays, int *solsticedays);
+void fequinoxsolstice(int year, double UTCoffset, double *equinoxdays, double *solsticedays);
+int calculatesunlongitude30(int year, int degreeGMToffset, int *ichinesemonths);
diff --git a/usr.bin/calendar/calendars/calendar.australia b/usr.bin/calendar/calendars/calendar.australia
index 323e7eeffee1..daa07ff26d50 100644
--- a/usr.bin/calendar/calendars/calendar.australia
+++ b/usr.bin/calendar/calendars/calendar.australia
@@ -10,49 +10,63 @@
LANG=en_AU.ISO8859-1
/* Australia */
-Jan 26 Australia Day
-Mar/SunLast Daylight Savings Time ends in ACT, NSW, SA, TAS and VIC.
-Apr 25 Anzac Day
+Jan 26 Australia Day
+Apr/SunFirst Daylight Savings Time ends in ACT, NSW, SA, TAS and VIC.
+Apr 25 Anzac Day
Jun/MonSecond Queen's Birthday Holiday (Australia, except WA)
-Oct/SunLast Daylight Savings Time starts in ACT, NSW, SA and VIC.
+Oct/SunFirst Daylight Savings Time starts in ACT, NSW, SA and VIC.
/* ACT, NSW, common */
-Mar 18 Canberra Day (ACT)
-8/MonFirst Bank Holiday (ACT, NSW)
-10/MonFirst Labour Day (ACT, NSW, SA)
+Mar 18 Canberra Day (ACT)
+Sep/MonLast Family & Community Day (ACT)
+Aug/MonFirst Bank Holiday (ACT, NSW)
+Oct/MonFirst Labour Day (ACT, NSW, SA)
/* Victoria */
-3/MonSecond Labour Day (Vic)
-Nov/TueFirst Melbourne Cup (Vic)
-
-/* Tasmania */
-Feb 11 Regatta Day (Tas)
-Feb 27 Launceston Cup (Tas)
-Mar 11 Eight Hours Day (Tas)
-Oct/SunFirst Daylight Savings Time starts in TAS.
-Oct 10 Launceston Show Day (Tas)
-Oct 24 Hobart Show Day (Tas)
-Nov 04 Recreation Day (N Tas)
+Mar/MonSecond Labour Day (VIC)
+Nov/TueFirst Melbourne Cup (VIC)
+
+/* Tasmania
+ * http://www.wst.tas.gov.au/employment_info/public_holidays/html/2010
+ */
+Feb/MonSecond Regatta Day (TAS)
+Feb/WedLast Launceston Cup (TAS)
+Mar/TueFirst King Island show (TAS)
+Mar/MonSecond Eight Hours Day (TAS)
+Oct 10 Launceston Show Day (TAS) /* Thursday preceding second Saturday in October */
+Oct 24 Hobart Show Day (TAS) /* Thursday preceding fourth Saturday in October */
+Nov/MonFirst Recreation Day (N TAS)
+
+/*
+Oct/SatSecond-2 Launceston Show Day (TAS) // Thursday preceding second Sat in October
+Oct/SatFourth-2 Hobart Show Day (TAS) // Thursday preceding fourth Sat in October
+May/ThuFirst+1 Agfest (Circular Head only) // Friday following the first Thursday in May
+Oct/SatFirst-1 Burnie Show // Friday preceding first Saturday in October
+Oct/SatThird-1 Flinders Island Show // Friday preceding third Saturday in October
+
+DEVONPORT CUP Wednesday not earlier than fifth and not later than eleventh day of January
+DEVONPORT SHOW Friday nearest last day in November, but not later than first day of December
+*/
/* South Australia */
May/MonThird Adelaide Cup (SA)
-Dec 26 Proclamation Day holiday (SA)
+Dec 26 Proclamation Day holiday (SA)
/* Western Australia */
-3/MonFirst Labour Day (WA)
-6/MonFirst Foundation Day (WA)
-Sep 30 Queen's Birthday (WA)
+Mar/MonFirst Labour Day (WA)
+Jun/MonFirst Foundation Day (WA)
+Sep 30 Queen's Birthday (WA)
/* Northern Territory */
-5/MonFirst May Day (NT)
-7/FriFirst Alice Springs Show Day (NT)
-7/FriSecond Tennant Creek Show Day (NT)
-7/FriThird Katherine Show Day (NT)
-7/FriLast Darwin Show Day (NT)
-8/MonFirst Picnic Day (NT)
+May/MonFirst May Day (NT)
+Jul/FriFirst Alice Springs Show Day (NT)
+Jul/FriSecond Tennant Creek Show Day (NT)
+Jul/FriThird Katherine Show Day (NT)
+Jul/FriLast Darwin Show Day (NT)
+Aug/MonFirst Picnic Day (NT)
/* Queensland */
-5/MonFirst Labour Day (Qld)
-Aug 14 RNA Show Day (Brisbane metro)
+May/MonFirst Labour Day (QLD)
+Aug/WedSecond RNA Show Day (Brisbane metro) /* Second Last Wednesday */
#endif
diff --git a/usr.bin/calendar/calendars/calendar.dutch b/usr.bin/calendar/calendars/calendar.dutch
index 47b1bf520a4e..fab179366fdf 100644
--- a/usr.bin/calendar/calendars/calendar.dutch
+++ b/usr.bin/calendar/calendars/calendar.dutch
@@ -10,25 +10,25 @@ Easter=Pasen
/*
* Feestdagen
*/
-01/01 Nieuwjaar
-01/06 Driekoningen
-04/01 Een April
-04/30 Koninginendag
-05/01 Dag van de Arbeid
-05/04 Dodenherdenking
-05/05 Bevrijdingsdag
-10/04 Dierendag
-11/01 Allerheilingen
-11/02 Allerzielen
-11/11 Sint Maarten
-11/11 Elfde-van-de-elfde
-12/05 Sinterklaas avond
-12/15 Koninkrijksdag
-12/24 Kerstavond
-12/25 Eerste kerstdag
-12/26 Tweede kerstdag
-12/28 Feest der Onnozele Kinderen
-12/31 Oudjaar
+jan/01 Nieuwjaar
+jan/06 Driekoningen
+apr/01 1 april
+apr/30 Koninginnedag
+mei/01 Dag van de Arbeid
+mei/04 Dodenherdenking
+mei/05 Bevrijdingsdag
+okt/04 Dierendag
+nov/01 Allerheiligen
+nov/02 Allerzielen
+nov/11 Sint Maarten
+nov/11 Elfde-van-de-elfde
+dec/05 Sinterklaas avond
+dec/15 Koninkrijksdag
+dec/24 Kerstavond
+dec/25 Eerste kerstdag
+dec/26 Tweede kerstdag
+dec/28 Feest der Onnozele Kinderen
+dec/31 Oudjaar
/*
* Pasen gerelateerd
@@ -38,12 +38,12 @@ Pasen-49 Carnaval
Pasen-48 Carnaval
Pasen-47 Carnaval (Vastenavond)
Pasen-46 Aswoensdag
-Pasen-7 Palmzondag
-Pasen-3 Witte Donderdag
-Pasen-2 Goede vrijdag
-Pasen-1 Stille zaterdag
+Pasen-7 Palmzondag
+Pasen-3 Witte Donderdag
+Pasen-2 Goede vrijdag
+Pasen-1 Stille zaterdag
Pasen Eerste paasdag
-Pasen+1 Tweede paasdag
+Pasen+1 Tweede paasdag
Pasen+39 Hemelvaartsdag
Pasen+49 Eerste Pinksterdag
Pasen+50 Tweede Pinksterdag
@@ -52,28 +52,28 @@ Pasen+56 Trinitatis
/*
* Misc
*/
-05/SunSecond Moederdag
-06/SunThird Vaderdag
-09/TueThird Prinsjesdag
+mei/SunSecond Moederdag
+jun/SunThird Vaderdag
+sep/TueThird Prinsjesdag
/*
* Het koningshuis
*/
-01/19 Prinses Margriet (1943)
-01/31 Koningin Beatrix (1938)
-02/17 Prins Willem III (1817 - 1890)
-02/18 Prinses Christina (1947)
-04/10 Prinses Ariane (2007)
-04/19 Prins Hendrik (1876 - 1934)
-04/27 Kroonprins Willem Alexander (1967)
-04/30 Koningin Juliana (1909 - 2004)
-04/30 Mr. Pieter van Vollenhoven (1939)
-05/17 Prinses Maxima (1971)
-06/26 Prinses Alexia (2005)
-06/29 Prins Bernhard (1911 - 2004)
-08/05 Prinses Irene (1939)
-08/31 Prinses Wilhelmina (1880 - 1962)
-09/06 Prins Claus (1925 - 2002)
-09/25 Prins Johan Friso (1968)
-10/11 Prins Constantijn (1969)
-12/07 Prinses Catharina-Amalia (2003)
+jan/19 Prinses Margriet (1943)
+jan/31 Koningin Beatrix (1938)
+feb/17 Prins Willem III (1817 - 1890)
+feb/18 Prinses Christina (1947)
+apr/10 Prinses Ariane (2007)
+apr/19 Prins Hendrik (1876 - 1934)
+apr/27 Kroonprins Willem Alexander (1967)
+apr/30 Koningin Juliana (1909 - 2004)
+apr/30 Mr. Pieter van Vollenhoven (1939)
+mei/17 Prinses Maxima (1971)
+jun/26 Prinses Alexia (2005)
+jun/29 Prins Bernhard (1911 - 2004)
+aug/05 Prinses Irene (1939)
+aug/31 Prinses Wilhelmina (1880 - 1962)
+sep/06 Prins Claus (1925 - 2002)
+sep/25 Prins Johan Friso (1968)
+okt/11 Prins Constantijn (1969)
+dec/07 Prinses Catharina-Amalia (2003)
diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd
index cbb16963cdd6..273be1645cc5 100644
--- a/usr.bin/calendar/calendars/calendar.freebsd
+++ b/usr.bin/calendar/calendars/calendar.freebsd
@@ -72,6 +72,7 @@
03/03 Doug White <dwhite@FreeBSD.org> born in Eugene, Oregon, United States, 1977
03/03 Gordon Tetlow <gordon@FreeBSD.org> born in Reno, Nevada, United States, 1978
03/04 Oleksandr Tymoshenko <gonzo@FreeBSD.org> born in Chernihiv, Ukraine, 1980
+03/05 Baptiste Daroussin <bapt@FreeBSD.org> born in Beauvais, France, 1980
03/05 Philip Paeps <philip@FreeBSD.org> born in Leuven, Belgium, 1983
03/05 Ulf Lilleengen <lulf@FreeBSD.org> born in Hamar, Norway, 1985
03/06 Christopher Piazza <cpiazza@FreeBSD.org> born in Kamloops, British Columbia, Canada, 1981
@@ -82,6 +83,7 @@
03/12 Greg Lewis <glewis@FreeBSD.org> born in Adelaide, South Australia, Australia, 1969
03/13 Alexander Leidinger <netchild@FreeBSD.org> born in Neunkirchen, Saarland, Germany, 1976
03/13 Will Andrews <will@FreeBSD.org> born in Pontiac, Michigan, United States, 1982
+03/14 Bernhard Froehlich <decke@FreeBSD.org> born in Graz, Styria, Austria, 1985
03/15 Paolo Pisati <piso@FreeBSD.org> born in Lodi, Italy, 1977
03/15 Brian Fundakowski Feldman <green@FreeBSD.org> born in Alexandria, Virginia, United States, 1983
03/17 Michael Smith <msmith@FreeBSD.org> born in Bankstown, New South Wales, Australia, 1971
@@ -91,6 +93,7 @@
03/20 MANTANI Nobutaka <nobutaka@FreeBSD.org> born in Hiroshima, Japan, 1978
03/20 Cameron Grant <cg@FreeBSD.org> died in Hemel Hempstead, United Kingdom, 2005
03/20 Henrik Brix Andersen <brix@FreeBSD.org> born in Aarhus, Denmark, 1978
+03/20 Joseph S. Atkinson <jsa@FreeBSD.org> born in Batesville, Arkansas, United States, 1977
03/22 Brad Davis <brd@FreeBSD.org> born in Farmington, New Mexico, United States, 1983
03/23 Daniel C. Sobral <dcs@FreeBSD.org> born in Brasilia, Distrito Federal, Brazil, 1971
03/23 Benno Rice <benno@FreeBSD.org> born in Adelaide, South Australia, Australia, 1977
@@ -135,6 +138,7 @@
05/11 Jesus Rodriguez <jesusr@FreeBSD.org> born in Barcelona, Spain, 1972
05/11 Roman Kurakin <rik@FreeBSD.org> born in Moscow, USSR, 1979
05/13 Pete Fritchman <petef@FreeBSD.org> born in Lansdale, Pennsylvania, United States, 1983
+05/14 Bruce Cran <brucec@FreeBSD.org> born in Cambridge, United Kingdom, 1981
05/14 Tatsumi Hosokawa <hosokawa@FreeBSD.org> born in Tokyo, Japan, 1968
05/14 Shigeyuku Fukushima <shige@FreeBSD.org> born in Osaka, Japan, 1974
05/16 Johann Kois <jkois@FreeBSD.org> born in Wolfsberg, Austria, 1975
@@ -200,6 +204,7 @@
07/19 Masafumi NAKANE <max@FreeBSD.org> born in Okazaki, Aichi, Japan, 1972
07/19 Simon L. Nielsen <simon@FreeBSD.org> born in Copenhagen, Denmark, 1980
07/19 Gleb Smirnoff <glebius@FreeBSD.org> born in Kharkov, USSR, 1981
+07/20 Andrey V. Elsukov <ae@FreeBSD.org> born in Kotelnich, Russian Federation, 1981
07/22 James Housley <jeh@FreeBSD.org> born in Chicago, Illinois, United States, 1965
07/22 Jens Schweikhardt <schweikh@FreeBSD.org> born in Waiblingen, Baden-Wuerttemberg, Germany, 1967
07/22 Lukas Ertl <le@FreeBSD.org> born in Weissenbach/Enns, Steiermark, Austria, 1976
@@ -251,6 +256,7 @@
09/12 Benedict Christopher Reuschling <bcr@FreeBSD.org> born in Darmstadt, Germany, 1981
09/15 Dima Panov <fluffy@FreeBSD.org> born in Khabarovsk, Russian Federation, 1978
09/17 Maxim Bolotin <mb@FreeBSD.org> born in Rostov-on-Don, Russian Federation, 1976
+09/18 Matthew Fleming <mdf@FreeBSD.org> born in Cleveland, Ohio, United States, 1975
09/20 Kevin Lo <kevlo@FreeBSD.org> born in Taipei, Taiwan, Republic of China, 1972
09/27 Neil Blakey-Milner <nbm@FreeBSD.org> born in Port Elizabeth, South Africa, 1978
09/27 Renato Botelho <garga@FreeBSD.org> born in Araras, Sao Paulo, Brazil, 1979
@@ -284,6 +290,7 @@
11/10 Gregory Neil Shapiro <gshapiro@FreeBSD.org> born in Providence, Rhode Island, United States, 1970
11/13 John Baldwin <jhb@FreeBSD.org> born in Stuart, Virginia, United States, 1977
11/15 Lars Engels <lme@FreeBSD.org> born in Hilden, Nordrhein-Westfalen, Germany, 1980
+11/15 Tijl Coosemans <tijl@FreeBSD.org> born in Duffel, Belgium, 1983
11/16 Jose Maria Alcaide Salinas <jmas@FreeBSD.org> born in Madrid, Spain, 1962
11/17 Ralf S. Engelschall <rse@FreeBSD.org> born in Dachau, Bavaria, Germany, 1972
11/18 Thomas Quinot <thomas@FreeBSD.org> born in Paris, France, 1977
diff --git a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common
index ae9db453885e..8367d42eb20d 100644
--- a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common
+++ b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common
@@ -18,6 +18,7 @@ LANG=ru_RU.KOI8-R
10 фев День дипломатического работника
1 мар Всемирный день гражданской обороны
03/SunSecond День работников геодезии и картографии
+11 мар День работника органов наркоконтроля
18 мар День налоговой полиции
03/SunThird День работников торговли, бытового обслуживания населения и жилищно-коммунального хозяйства
27 мар Международный день театра
@@ -33,22 +34,28 @@ LANG=ru_RU.KOI8-R
17 май Международный день телекоммуникаций
18 май Международный день музеев
24 май День славянской письменности и культуры
+26 май День российского предпринимательства
27 май Общероссийский день библиотек
28 май День пограничника
+30 май День пожарной охраны
+31 май День Российской Адвокатуры
05/SunLast День химика
1 июн День защиты детей
+ 5 июн День эколога
6 июн Пушкинский день
8 июн День социального работника
06/SunSecond День работников легкой промышленности
06/SunThird День медицинского работника
22 июн День памяти и скорби (Начало Великой Отечественной Войны, 1941 год)
27 июн День молодежи
+29 июн День партизан и подпольщиков
06/SatLast День изобретателя и рационализатора
07/SunFirst День работников морского и речного флота
07/SunSecond День рыбака
07/SunSecond День российской почты
07/SunThird День металлурга
07/SunLast День Военно-Морского Флота
+28 июл День крещения Руси
6 авг День железнодорожных войск
08/SunFirst День железнодорожника
12 авг День военно-воздушных сил
@@ -59,12 +66,16 @@ LANG=ru_RU.KOI8-R
08/SunLast День шахтера
1 сен День знаний
2 сен День российской гвардии
+ 3 сен День солидарности в борьбе с терроризмом
+ 4 сен День специалиста по ядерному обеспечению
09/SunFirst День работников нефтяной и газовой промышленности
09/SunSecond День танкиста
09/SunThird День работников леса
+28 сен День работника атомной промышленности
09/SunLast День машиностроителя
1 окт День пожилых людей
- 4 окт День военно-космических сил
+ 1 окт День сухопутных войск
+ 4 окт День космических войск
5 окт День учителя
14 окт Международный день стандартизации
10/SunSecond День работников сельского хозяйства и перерабатывающей промышленности
@@ -73,15 +84,19 @@ LANG=ru_RU.KOI8-R
25 окт День таможенника
30 окт День памяти жертв политических репрессий
10/SunLast День работников автомобильного транспорта
+ 7 ноя День октябрьской революции 1917 года
9 ноя Всемирный день качества
10 ноя День милиции
16 ноя День морской пехоты
17 ноя Международный день студентов
-11/SunThird День ракетных войск и артиллерии
+19 ноя День ракетных войск и артиллерии
21 ноя День работников налоговых органов
26 ноя Всемирный день информации
11/SunLast День матери
1 дек Всемирный день борьбы со СПИДом
+ 3 дек День юриста
+ 9 дек День Героев Отечества
+12 дек День Конституции
17 дек День ракетных войск стратегического назначения
20 дек День работника органов безопасности
22 дек День энергетика
diff --git a/usr.bin/calendar/day.c b/usr.bin/calendar/day.c
index d3f3c1ec4f29..237b6b5a7d92 100644
--- a/usr.bin/calendar/day.c
+++ b/usr.bin/calendar/day.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -34,9 +30,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <ctype.h>
#include <err.h>
#include <locale.h>
#include <stdio.h>
@@ -44,123 +37,40 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <time.h>
-#include "pathnames.h"
#include "calendar.h"
-struct tm *tp;
-static const struct tm tm0;
-int *cumdays, yrdays;
-char dayname[10];
-
-
-/* 1-based month, 0-based days, cumulative */
-int daytab[][14] = {
- {0, -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364},
- {0, -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
-};
-
-static char const *days[] = {
- "sun", "mon", "tue", "wed", "thu", "fri", "sat", NULL,
-};
-
-static const char *months[] = {
- "jan", "feb", "mar", "apr", "may", "jun",
- "jul", "aug", "sep", "oct", "nov", "dec", NULL,
-};
-
-static struct fixs fndays[8]; /* full national days names */
-static struct fixs ndays[8]; /* short national days names */
-
-static struct fixs fnmonths[13]; /* full national months names */
-static struct fixs nmonths[13]; /* short national month names */
+time_t time1, time2;
+const struct tm tm0;
+char dayname[100];
+int year1, year2;
void
-setnnames(void)
+settimes(time_t now, int before, int after, int friday, struct tm *tp1, struct tm *tp2)
{
- char buf[80];
- int i, l;
- struct tm tm;
-
- for (i = 0; i < 7; i++) {
- tm.tm_wday = i;
- strftime(buf, sizeof(buf), "%a", &tm);
- for (l = strlen(buf);
- l > 0 && isspace((unsigned char)buf[l - 1]);
- l--)
- ;
- buf[l] = '\0';
- if (ndays[i].name != NULL)
- free(ndays[i].name);
- if ((ndays[i].name = strdup(buf)) == NULL)
- errx(1, "cannot allocate memory");
- ndays[i].len = strlen(buf);
-
- strftime(buf, sizeof(buf), "%A", &tm);
- for (l = strlen(buf);
- l > 0 && isspace((unsigned char)buf[l - 1]);
- l--)
- ;
- buf[l] = '\0';
- if (fndays[i].name != NULL)
- free(fndays[i].name);
- if ((fndays[i].name = strdup(buf)) == NULL)
- errx(1, "cannot allocate memory");
- fndays[i].len = strlen(buf);
- }
+ char *oldl, *lbufp;
+ struct tm tp;
- for (i = 0; i < 12; i++) {
- tm.tm_mon = i;
- strftime(buf, sizeof(buf), "%b", &tm);
- for (l = strlen(buf);
- l > 0 && isspace((unsigned char)buf[l - 1]);
- l--)
- ;
- buf[l] = '\0';
- if (nmonths[i].name != NULL)
- free(nmonths[i].name);
- if ((nmonths[i].name = strdup(buf)) == NULL)
- errx(1, "cannot allocate memory");
- nmonths[i].len = strlen(buf);
+ localtime_r(&now, &tp);
- strftime(buf, sizeof(buf), "%B", &tm);
- for (l = strlen(buf);
- l > 0 && isspace((unsigned char)buf[l - 1]);
- l--)
- ;
- buf[l] = '\0';
- if (fnmonths[i].name != NULL)
- free(fnmonths[i].name);
- if ((fnmonths[i].name = strdup(buf)) == NULL)
- errx(1, "cannot allocate memory");
- fnmonths[i].len = strlen(buf);
- }
-}
+ /* Friday displays Monday's events */
+ if (after == 0 && before == 0 && friday != -1)
+ after = tp.tm_wday == friday ? 3 : 1;
-void
-settime(time_t now)
-{
- char *oldl, *lbufp;
+ time1 = now - SECSPERDAY * before;
+ localtime_r(&time1, tp1);
+ year1 = 1900 + tp1->tm_year;
+ time2 = now + SECSPERDAY * after;
+ localtime_r(&time2, tp2);
+ year2 = 1900 + tp2->tm_year;
- tp = localtime(&now);
- if (isleap(tp->tm_year + 1900)) {
- yrdays = 366;
- cumdays = daytab[1];
- } else {
- yrdays = 365;
- cumdays = daytab[0];
- }
- /* Friday displays Monday's events */
- if (f_dayAfter == 0 && f_dayBefore == 0 && Friday != -1)
- f_dayAfter = tp->tm_wday == Friday ? 3 : 1;
- header[5].iov_base = dayname;
+ strftime(dayname, sizeof(dayname) - 1, "%A, %d %B %Y", tp1);
oldl = NULL;
lbufp = setlocale(LC_TIME, NULL);
if (lbufp != NULL && (oldl = strdup(lbufp)) == NULL)
errx(1, "cannot allocate memory");
(void)setlocale(LC_TIME, "C");
- header[5].iov_len = strftime(dayname, sizeof(dayname), "%A", tp);
(void)setlocale(LC_TIME, (oldl != NULL ? oldl : ""));
if (oldl != NULL)
free(oldl);
@@ -176,15 +86,15 @@ Mktime(char *dp)
{
time_t t;
int d, m, y;
- struct tm tm;
+ struct tm tm, tp;
(void)time(&t);
- tp = localtime(&t);
+ localtime_r(&t, &tp);
tm = tm0;
- tm.tm_mday = tp->tm_mday;
- tm.tm_mon = tp->tm_mon;
- tm.tm_year = tp->tm_year;
+ tm.tm_mday = tp.tm_mday;
+ tm.tm_mon = tp.tm_mon;
+ tm.tm_year = tp.tm_year;
switch (sscanf(dp, "%d.%d.%d", &d, &m, &y)) {
case 3:
@@ -205,282 +115,3 @@ Mktime(char *dp)
#endif
return (mktime(&tm));
}
-
-/*
- * Possible date formats include any combination of:
- * 3-charmonth (January, Jan, Jan)
- * 3-charweekday (Friday, Monday, mon.)
- * numeric month or day (1, 2, 04)
- *
- * Any character may separate them, or they may not be separated. Any line,
- * following a line that is matched, that starts with "whitespace", is shown
- * along with the matched line.
- */
-int
-isnow(char *endp, int *monthp, int *dayp, int *varp)
-{
- int day, flags, month = 0, v1, v2;
-
- /*
- * CONVENTION
- *
- * Month: 1-12
- * Monthname: Jan .. Dec
- * Day: 1-31
- * Weekday: Mon-Sun
- *
- */
-
- flags = 0;
-
- /* read first field */
- /* didn't recognize anything, skip it */
- if (!(v1 = getfield(endp, &endp, &flags)))
- return (0);
-
- /* Easter or Easter depending days */
- if (flags & F_EASTER)
- day = v1 - 1; /* days since January 1 [0-365] */
-
- /*
- * 1. {Weekday,Day} XYZ ...
- *
- * where Day is > 12
- */
- else if (flags & F_ISDAY || v1 > 12) {
-
- /* found a day; day: 1-31 or weekday: 1-7 */
- day = v1;
-
- /* {Day,Weekday} {Month,Monthname} ... */
- /* if no recognizable month, assume just a day alone
- * in other words, find month or use current month */
- if (!(month = getfield(endp, &endp, &flags)))
- month = tp->tm_mon + 1;
- }
-
- /* 2. {Monthname} XYZ ... */
- else if (flags & F_ISMONTH) {
- month = v1;
-
- /* Monthname {day,weekday} */
- /* if no recognizable day, assume the first day in month */
- if (!(day = getfield(endp, &endp, &flags)))
- day = 1;
- }
-
- /* Hm ... */
- else {
- v2 = getfield(endp, &endp, &flags);
-
- /*
- * {Day} {Monthname} ...
- * where Day <= 12
- */
- if (flags & F_ISMONTH) {
- day = v1;
- month = v2;
- *varp = 0;
- }
-
- /* {Month} {Weekday,Day} ... */
- else {
- /* F_ISDAY set, v2 > 12, or no way to tell */
- month = v1;
- /* if no recognizable day, assume the first */
- day = v2 ? v2 : 1;
- *varp = 0;
- }
- }
-
- /* convert Weekday into *next* Day,
- * e.g.: 'Sunday' -> 22
- * 'SundayLast' -> ??
- */
- if (flags & F_ISDAY) {
-#ifdef DEBUG
- fprintf(stderr, "\nday: %d %s month %d\n", day, endp, month);
-#endif
-
- *varp = 1;
- /* variable weekday, SundayLast, MondayFirst ... */
- if (day < 0 || day >= 10) {
-
- /* negative offset; last, -4 .. -1 */
- if (day < 0) {
- v1 = day / 10 - 1; /* offset -4 ... -1 */
- day = 10 + (day % 10); /* day 1 ... 7 */
-
- /* day, eg '22nd' */
- v2 = tp->tm_mday +
- (((day - 1) - tp->tm_wday + 7) % 7);
-
- /* (month length - day) / 7 + 1 */
- if (cumdays[month + 1] - cumdays[month] >= v2
- && ((int)((cumdays[month + 1] -
- cumdays[month] - v2) / 7) + 1) == -v1)
- day = v2; /* bingo ! */
-
- /* set to yesterday */
- else {
- day = tp->tm_mday - 1;
- if (day == 0)
- return (0);
- }
- }
-
- /* first, second ... +1 ... +5 */
- else {
- /* offset: +1 (first Sunday) ... */
- v1 = day / 10;
- day = day % 10;
-
- /* day, eg '22th' */
- v2 = tp->tm_mday +
- (((day - 1) - tp->tm_wday + 7) % 7);
-
- /* Hurrah! matched */
- if (((v2 - 1 + 7) / 7) == v1 )
- day = v2;
-
- else {
- /* set to yesterday */
- day = tp->tm_mday - 1;
- if (day == 0)
- return (0);
- }
- }
- } else {
- /* wired */
- day = tp->tm_mday + (((day - 1) - tp->tm_wday + 7) % 7);
- *varp = 1;
- }
- }
-
- if (!(flags & F_EASTER)) {
- if (day + cumdays[month] > cumdays[month + 1]) {
- /* off end of month, adjust */
- day -= (cumdays[month + 1] - cumdays[month]);
- /* next year */
- if (++month > 12)
- month = 1;
- }
- *monthp = month;
- *dayp = day;
- day = cumdays[month] + day;
- } else {
- for (v1 = 0; day > cumdays[v1]; v1++)
- ;
- *monthp = v1 - 1;
- *dayp = day - cumdays[v1 - 1];
- *varp = 1;
- }
-
-#ifdef DEBUG
- fprintf(stderr, "day2: day %d(%d-%d) yday %d\n",
- *dayp, day, cumdays[month], tp->tm_yday);
-#endif
-
- /* When days before or days after is specified */
- /* no year rollover */
- if (day >= tp->tm_yday - f_dayBefore &&
- day <= tp->tm_yday + f_dayAfter)
- return (1);
-
- /* next year */
- if (tp->tm_yday + f_dayAfter >= yrdays) {
- int end = tp->tm_yday + f_dayAfter - yrdays;
- if (day <= end)
- return (1);
- }
-
- /* previous year */
- if (tp->tm_yday - f_dayBefore < 0) {
- int before = yrdays + (tp->tm_yday - f_dayBefore);
- if (day >= before)
- return (1);
- }
-
- return (0);
-}
-
-
-int
-getmonth(char *s)
-{
- const char **p;
- struct fixs *n;
-
- for (n = fnmonths; n->name; ++n)
- if (!strncasecmp(s, n->name, n->len))
- return ((n - fnmonths) + 1);
- for (n = nmonths; n->name; ++n)
- if (!strncasecmp(s, n->name, n->len))
- return ((n - nmonths) + 1);
- for (p = months; *p; ++p)
- if (!strncasecmp(s, *p, 3))
- return ((p - months) + 1);
- return (0);
-}
-
-
-int
-getday(char *s)
-{
- const char **p;
- struct fixs *n;
-
- for (n = fndays; n->name; ++n)
- if (!strncasecmp(s, n->name, n->len))
- return ((n - fndays) + 1);
- for (n = ndays; n->name; ++n)
- if (!strncasecmp(s, n->name, n->len))
- return ((n - ndays) + 1);
- for (p = days; *p; ++p)
- if (!strncasecmp(s, *p, 3))
- return ((p - days) + 1);
- return (0);
-}
-
-/* return offset for variable weekdays
- * -1 -> last weekday in month
- * +1 -> first weekday in month
- * ... etc ...
- */
-int
-getdayvar(char *s)
-{
- int offs;
-
- offs = strlen(s);
-
- /* Sun+1 or Wednesday-2
- * ^ ^ */
-
- /* fprintf(stderr, "x: %s %s %d\n", s, s + offs - 2, offs); */
- switch (*(s + offs - 2)) {
- case '-':
- return (-(atoi(s + offs - 1)));
- case '+':
- return (atoi(s + offs - 1));
- }
-
- /*
- * some aliases: last, first, second, third, fourth
- */
-
- /* last */
- if (offs > 4 && !strcasecmp(s + offs - 4, "last"))
- return (-1);
- else if (offs > 5 && !strcasecmp(s + offs - 5, "first"))
- return (+1);
- else if (offs > 6 && !strcasecmp(s + offs - 6, "second"))
- return (+2);
- else if (offs > 5 && !strcasecmp(s + offs - 5, "third"))
- return (+3);
- else if (offs > 6 && !strcasecmp(s + offs - 6, "fourth"))
- return (+4);
-
- /* no offset detected */
- return (0);
-}
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c
index 92df7be2582d..ef98d5da9b5f 100644
--- a/usr.bin/calendar/io.c
+++ b/usr.bin/calendar/io.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -46,11 +42,8 @@ static char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/uio.h>
#include <sys/wait.h>
#include <ctype.h>
#include <err.h>
@@ -66,62 +59,63 @@ __FBSDID("$FreeBSD$");
#include "pathnames.h"
#include "calendar.h"
-/*
- * Event sorting related functions:
- * - Use event_add() to create a new event
- * - Use event_continue() to add more text to the last added event
- * - Use event_print_all() to display them in time chronological order
- */
-static struct event *event_add(struct event *, int, int, char *, int, char *);
-static void event_continue(struct event *events, char *txt);
-static void event_print_all(FILE *fp, struct event *events);
-struct event {
- int month;
- int day;
- int var;
- char *date;
- char *text;
- struct event *next;
-};
-
const char *calendarFile = "calendar"; /* default calendar file */
const char *calendarHomes[] = {".calendar", _PATH_INCLUDE}; /* HOME */
const char *calendarNoMail = "nomail"; /* don't sent mail if this file exist */
char path[MAXPATHLEN];
-struct fixs neaster, npaskha;
-
-struct iovec header[] = {
- {"From: ", 6},
- {NULL, 0},
- {" (Reminder Service)\nTo: ", 24},
- {NULL, 0},
- {"\nSubject: ", 10},
- {NULL, 0},
- {"'s Calendar\nPrecedence: bulk\n\n", 30},
-};
-
+struct fixs neaster, npaskha, ncny, nfullmoon, nnewmoon;
+struct fixs nmarequinox, nsepequinox, njunsolstice, ndecsolstice;
+
+#define REPLACE(string, slen, struct_) \
+ if (strncasecmp(buf, (string), (slen)) == 0 && buf[(slen)]) { \
+ if (struct_.name != NULL) \
+ free(struct_.name); \
+ if ((struct_.name = strdup(buf + (slen))) == NULL) \
+ errx(1, "cannot allocate memory"); \
+ struct_.len = strlen(buf + (slen)); \
+ continue; \
+ }
void
cal(void)
{
- int printing;
- char *p;
+ char *pp, p;
FILE *fp;
int ch, l;
- int month;
- int day;
- int var;
+ int count, i;
+ int month[MAXCOUNT];
+ int day[MAXCOUNT];
+ int year[MAXCOUNT];
+ char **extradata; /* strings of 20 length */
+ int flags;
static int d_first = -1;
char buf[2048 + 1];
- struct event *events = NULL;
+ struct event *events[MAXCOUNT];
+ struct tm tm;
+ char dbuf[80];
+
+ extradata = (char **)calloc(MAXCOUNT, sizeof(char *));
+ for (i = 0; i < MAXCOUNT; i++) {
+ extradata[i] = (char *)calloc(1, 20);
+ }
+
+ /* Unused */
+ tm.tm_sec = 0;
+ tm.tm_min = 0;
+ tm.tm_hour = 0;
+ tm.tm_wday = 0;
- if ((fp = opencal()) == NULL)
+ count = 0;
+ if ((fp = opencal()) == NULL) {
+ free(extradata);
return;
- for (printing = 0; fgets(buf, sizeof(buf), stdin) != NULL;) {
- if ((p = strchr(buf, '\n')) != NULL)
- *p = '\0';
+ }
+ while (fgets(buf, sizeof(buf), stdin) != NULL) {
+ if ((pp = strchr(buf, '\n')) != NULL)
+ *pp = '\0';
else
+ /* Flush this line */
while ((ch = getchar()) != '\n' && ch != EOF);
for (l = strlen(buf);
l > 0 && isspace((unsigned char)buf[l - 1]);
@@ -130,246 +124,88 @@ cal(void)
buf[l] = '\0';
if (buf[0] == '\0')
continue;
+
+ /* Parse special definitions: LANG, Easter, Paskha etc */
if (strncmp(buf, "LANG=", 5) == 0) {
(void)setlocale(LC_ALL, buf + 5);
d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
setnnames();
continue;
}
- if (strncasecmp(buf, "Easter=", 7) == 0 && buf[7]) {
- if (neaster.name != NULL)
- free(neaster.name);
- if ((neaster.name = strdup(buf + 7)) == NULL)
- errx(1, "cannot allocate memory");
- neaster.len = strlen(buf + 7);
- continue;
- }
- if (strncasecmp(buf, "Paskha=", 7) == 0 && buf[7]) {
- if (npaskha.name != NULL)
- free(npaskha.name);
- if ((npaskha.name = strdup(buf + 7)) == NULL)
- errx(1, "cannot allocate memory");
- npaskha.len = strlen(buf + 7);
+ REPLACE("Easter=", 7, neaster);
+ REPLACE("Paskha=", 7, npaskha);
+ REPLACE("ChineseNewYear=", 15, ncny);
+ REPLACE("NewMoon=", 8, nnewmoon);
+ REPLACE("FullMoon=", 9, nfullmoon);
+ REPLACE("MarEquinox=", 11, nmarequinox);
+ REPLACE("SepEquinox=", 11, nsepequinox);
+ REPLACE("JunSolstice=", 12, njunsolstice);
+ REPLACE("DecSolstice=", 12, ndecsolstice);
+ if (strncmp(buf, "SEQUENCE=", 9) == 0) {
+ setnsequences(buf + 9);
continue;
}
- 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) {
- struct tm tm;
- char dbuf[80];
-
- if (d_first < 0)
- d_first =
- (*nl_langinfo(D_MD_ORDER) == 'd');
- tm.tm_sec = 0; /* unused */
- tm.tm_min = 0; /* unused */
- tm.tm_hour = 0; /* unused */
- tm.tm_wday = 0; /* unused */
- tm.tm_mon = month - 1;
- tm.tm_mday = day;
- tm.tm_year = tp->tm_year; /* unused */
- (void)strftime(dbuf, sizeof(dbuf),
- d_first ? "%e %b" : "%b %e", &tm);
- events = event_add(events, month, day, dbuf,
- var, p);
- }
- } else {
- if (printing)
- event_continue(events, buf);
- }
- }
-
- event_print_all(fp, events);
- closecal(fp);
-}
-
-static struct event *
-event_add(struct event *events, int month, int day,
- char *date, int var, char *txt)
-{
- struct event *e;
-
- /*
- * Creating a new event:
- * - Create a new event
- * - Copy the machine readable day and month
- * - Copy the human readable and language specific date
- * - Copy the text of the event
- */
- e = (struct event *)calloc(1, sizeof(struct event));
- if (e == NULL)
- errx(1, "event_add: cannot allocate memory");
- e->month = month;
- e->day = day;
- e->var = var;
- e->date = strdup(date);
- if (e->date == NULL)
- errx(1, "event_add: cannot allocate memory");
- e->text = strdup(txt);
- if (e->text == NULL)
- errx(1, "event_add: cannot allocate memory");
- e->next = events;
-
- return e;
-}
-
-static void
-event_continue(struct event *e, char *txt)
-{
- char *text;
-
- /*
- * Adding text to the event:
- * - Save a copy of the old text (unknown length, so strdup())
- * - Allocate enough space for old text + \n + new text + 0
- * - Store the old text + \n + new text
- * - Destroy the saved copy.
- */
- text = strdup(e->text);
- if (text == NULL)
- errx(1, "event_continue: cannot allocate memory");
-
- free(e->text);
- e->text = (char *)malloc(strlen(text) + strlen(txt) + 3);
- if (e->text == NULL)
- errx(1, "event_continue: cannot allocate memory");
- strcpy(e->text, text);
- strcat(e->text, "\n");
- strcat(e->text, txt);
- free(text);
-
- return;
-}
-
-static void
-event_print_all(FILE *fp, struct event *events)
-{
- struct event *e, *e_next;
- int daycounter;
- int day, month;
-
- /*
- * Print all events:
- * - We know the number of days to be counted (f_dayAfter + f_dayBefore)
- * - We know the current day of the year ("now" - f_dayBefore + counter)
- * - We know the number of days in the year (yrdays, set in settime())
- * - So we know the date on which the current daycounter is on the
- * calendar in days and months.
- * - Go through the list of events, and print all matching dates
- */
- for (daycounter = 0; daycounter <= f_dayAfter + f_dayBefore;
- daycounter++) {
- day = tp->tm_yday - f_dayBefore + daycounter;
- if (day < 0)
- day += yrdays;
- if (day >= yrdays)
- day -= yrdays;
/*
- * When we know the day of the year, we can determine the day
- * of the month and the month.
+ * If the line starts with a tab, the data has to be
+ * added to the previous line
*/
- month = 1;
- while (month <= 12) {
- if (day <= cumdays[month])
- break;
- month++;
+ if (buf[0] == '\t') {
+ for (i = 0; i < count; i++)
+ event_continue(events[i], buf);
+ continue;
}
- month--;
- day -= cumdays[month];
-#ifdef DEBUG
- fprintf(stderr, "event_print_allmonth: %d, day: %d\n",
- month, day);
-#endif
+ /* Get rid of leading spaces (non-standard) */
+ while (isspace((unsigned char)buf[0]))
+ memcpy(buf, buf + 1, strlen(buf));
- /*
- * Go through all events and print the text of the matching
- * dates
- */
- for (e = events; e != NULL; e = e_next) {
- e_next = e->next;
+ /* No tab in the line, then not a valid line */
+ if ((pp = strchr(buf, '\t')) == NULL)
+ continue;
- if (month != e->month || day != e->day)
- continue;
+ /* Trim spaces in front of the tab */
+ while (isspace((unsigned char)pp[-1]))
+ pp--;
- (void)fprintf(fp, "%s%c%s\n", e->date,
- e->var ? '*' : ' ', e->text);
+ p = *pp;
+ *pp = '\0';
+ if ((count = parsedaymonth(buf, year, month, day, &flags,
+ 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;
}
- }
-}
-int
-getfield(char *p, char **endp, int *flags)
-{
- int val, var;
- char *start, savech;
+ /* Find the last tab */
+ while (pp[1] == '\t')
+ pp++;
- for (; !isdigit((unsigned char)*p) && !isalpha((unsigned char)*p)
- && *p != '*'; ++p)
- ;
- if (*p == '*') { /* `*' is current month */
- *flags |= F_ISMONTH;
- *endp = p + 1;
- return (tp->tm_mon + 1);
- }
- if (isdigit((unsigned char)*p)) {
- val = strtol(p, &p, 10); /* if 0, it's failure */
- for (; !isdigit((unsigned char)*p)
- && !isalpha((unsigned char)*p) && *p != '*'; ++p);
- *endp = p;
- return (val);
- }
- for (start = p; isalpha((unsigned char)*++p););
-
- /* Sunday-1 */
- if (*p == '+' || *p == '-')
- for(; isdigit((unsigned char)*++p);)
- ;
-
- savech = *p;
- *p = '\0';
-
- /* Month */
- if ((val = getmonth(start)) != 0)
- *flags |= F_ISMONTH;
-
- /* Day */
- else if ((val = getday(start)) != 0) {
- *flags |= F_ISDAY;
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
- /* variable weekday */
- if ((var = getdayvar(start)) != 0) {
- if (var <= 5 && var >= -4)
- val += var * 10;
-#ifdef DEBUG
- printf("var: %d\n", var);
-#endif
+ for (i = 0; i < count; i++) {
+ tm.tm_mon = month[i] - 1;
+ tm.tm_mday = day[i];
+ tm.tm_year = year[i] - 1900;
+ (void)strftime(dbuf, sizeof(dbuf),
+ d_first ? "%e %b" : "%b %e", &tm);
+ if (debug)
+ fprintf(stderr, "got %s\n", pp);
+ events[i] = event_add(year[i], month[i], day[i], dbuf,
+ ((flags &= F_VARIABLE) != 0) ? 1 : 0, pp,
+ extradata[i]);
}
}
- /* Easter */
- else if ((val = geteaster(start, tp->tm_year + 1900)) != 0)
- *flags |= F_EASTER;
-
- /* Paskha */
- else if ((val = getpaskha(start, tp->tm_year + 1900)) != 0)
- *flags |= F_EASTER;
-
- /* undefined rest */
- else {
- *p = savech;
- return (0);
- }
- for (*p = savech; !isdigit((unsigned char)*p)
- && !isalpha((unsigned char)*p) && *p != '*'; ++p)
- ;
- *endp = p;
- return (val);
+ event_print_all(fp);
+ closecal(fp);
+ free(extradata);
}
FILE *
@@ -393,7 +229,8 @@ opencal(void)
char *home = getenv("HOME");
if (home == NULL || *home == '\0')
errx(1, "cannot get home directory");
- chdir(home);
+ if (chdir(home) != 0)
+ errx(1, "cannot enter home directory");
for (found = i = 0; i < sizeof(calendarHomes) /
sizeof(calendarHomes[0]); i++)
if (chdir(calendarHomes[i]) == 0 &&
@@ -467,7 +304,7 @@ closecal(FILE *fp)
if (!doall)
return;
- (void)rewind(fp);
+ rewind(fp);
if (fstat(fileno(fp), &sbuf) || !sbuf.st_size)
goto done;
if (pipe(pdes) < 0)
@@ -505,9 +342,14 @@ closecal(FILE *fp)
/* parent -- write to pipe input */
(void)close(pdes[0]);
- header[1].iov_base = header[3].iov_base = pw->pw_name;
- header[1].iov_len = header[3].iov_len = strlen(pw->pw_name);
- writev(pdes[1], header, 7);
+ write(pdes[1], "From: \"Reminder Service\" <", 26);
+ write(pdes[1], pw->pw_name, strlen(pw->pw_name));
+ write(pdes[1], ">\nTo: <", 7);
+ write(pdes[1], pw->pw_name, strlen(pw->pw_name));
+ write(pdes[1], ">\nSubject: ", 12);
+ write(pdes[1], dayname, strlen(dayname));
+ write(pdes[1], "'s Calendar\nPrecedence: bulk\n\n", 30);
+
while ((nread = read(fileno(fp), buf, sizeof(buf))) > 0)
(void)write(pdes[1], buf, nread);
(void)close(pdes[1]);
diff --git a/usr.bin/calendar/ostern.c b/usr.bin/calendar/ostern.c
index 76e593327a39..3cce2998f12a 100644
--- a/usr.bin/calendar/ostern.c
+++ b/usr.bin/calendar/ostern.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
* All rights reserved.
*
@@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "calendar.h"
@@ -61,50 +60,8 @@ easter(int year) /* 0 ... abcd, NOT since 1900 */
L = I - J;
- if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
+ if (isleap(year))
return 31 + 29 + 21 + L + 7;
else
return 31 + 28 + 21 + L + 7;
}
-
-/* return year day for Easter or easter depending days
- * Match: Easter([+-][0-9]+)?
- * e.g: Easter-2 is Good Friday (2 days before Easter)
- */
-
-int
-geteaster(char *s, int year)
-{
- int offset = 0;
-
-#define EASTER "easter"
-#define EASTERNAMELEN (sizeof(EASTER) - 1)
-
- if (strncasecmp(s, EASTER, EASTERNAMELEN) == 0)
- s += EASTERNAMELEN;
- else if (neaster.name != NULL
- && strncasecmp(s, neaster.name, neaster.len) == 0)
- s += neaster.len;
- else
- return (0);
-
-#if DEBUG
- printf("%s %d %d\n", s, year, EASTERNAMELEN);
-#endif
-
- /* Easter+1 or Easter-2
- * ^ ^ */
-
- switch (*s) {
-
- case '-':
- case '+':
- offset = atoi(s);
- break;
-
- default:
- offset = 0;
- }
-
- return (easter(year) + offset);
-}
diff --git a/usr.bin/calendar/paskha.c b/usr.bin/calendar/paskha.c
index d96ffc2546e0..373ee5d261cf 100644
--- a/usr.bin/calendar/paskha.c
+++ b/usr.bin/calendar/paskha.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (C) 1993-1996 by Andrey A. Chernov, Moscow, Russia.
* All rights reserved.
*
@@ -30,62 +30,28 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "calendar.h"
#define PASKHA "paskha"
#define PASKHALEN (sizeof(PASKHA) - 1)
-static int paskha(int);
-
/* return year day for Orthodox Easter using Gauss formula */
/* (old style result) */
-static int
+int
paskha(int R) /*year*/
{
int a, b, c, d, e;
static int x = 15;
static int y = 6;
+ int *cumday;
a = R % 19;
b = R % 4;
c = R % 7;
d = (19 * a + x) % 30;
e = (2 * b + 4 * c + 6 * d + y) % 7;
- return (((cumdays[3] + 1) + 22) + (d + e));
-}
-
-/* return year day for Orthodox Easter depending days */
-
-int
-getpaskha(char *s, int year)
-{
- int offset;
-
- if (strncasecmp(s, PASKHA, PASKHALEN) == 0)
- s += PASKHALEN;
- else if (npaskha.name != NULL
- && strncasecmp(s, npaskha.name, npaskha.len) == 0)
- s += npaskha.len;
- else
- return 0;
-
- /* Paskha+1 or Paskha-2
- * ^ ^ */
-
- switch (*s) {
-
- case '-':
- case '+':
- offset = atoi(s);
- break;
-
- default:
- offset = 0;
- break;
- }
-
- return (paskha(year) + offset + 13 /* new style */);
+ cumday = cumdaytab[isleap(R)];
+ return (((cumday[3] + 1) + 22) + (d + e));
}
diff --git a/usr.bin/calendar/pathnames.h b/usr.bin/calendar/pathnames.h
index cacbd2587acd..ea76948e2e3c 100644
--- a/usr.bin/calendar/pathnames.h
+++ b/usr.bin/calendar/pathnames.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.