diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1996-12-05 06:05:02 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1996-12-05 06:05:02 +0000 |
commit | ab14faef155f7dddf0b1d13ece77e15dd09a230d (patch) | |
tree | f603d35e446a05573f80059ca9563b33bb76809e | |
parent | 695bc36262cf9dab8191e45391079a6913144257 (diff) |
FreeBSD calendar(1) + OpenBSD changes.
36 files changed, 2085 insertions, 430 deletions
diff --git a/usr.bin/calendar/Makefile b/usr.bin/calendar/Makefile index b41b54725c0..39c98d15ab0 100644 --- a/usr.bin/calendar/Makefile +++ b/usr.bin/calendar/Makefile @@ -1,10 +1,19 @@ -# $OpenBSD: Makefile,v 1.2 1996/06/26 05:31:44 deraadt Exp $ -# $NetBSD: Makefile,v 1.6 1995/03/27 08:46:11 glass Exp $ +# $OpenBSD: Makefile,v 1.3 1996/12/05 06:04:36 millert Exp $ +# from: @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= calendar +SRCS= calendar.c io.c day.c ostern.c paskha.c +INTER= de_DE.ISO_8859-1 hr_HR.ISO_8859-2 ru_SU.KOI8-R beforeinstall: install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ ${.CURDIR}/calendars/calendar.* ${DESTDIR}/usr/share/calendar +.for lang in ${INTER} + @test -d ${DESTDIR}/usr/share/calendar/${lang} || \ + mkdir ${DESTDIR}/usr/share/calendar/${lang} + install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ + ${.CURDIR}/calendars/${lang}/calendar.* \ + ${DESTDIR}/usr/share/calendar/${lang}; +.endfor .include <bsd.prog.mk> diff --git a/usr.bin/calendar/calendar.1 b/usr.bin/calendar/calendar.1 index 636ef78adb0..09f6a5440d5 100644 --- a/usr.bin/calendar/calendar.1 +++ b/usr.bin/calendar/calendar.1 @@ -1,8 +1,7 @@ -.\" $OpenBSD: calendar.1,v 1.2 1996/06/26 05:31:45 deraadt Exp $ -.\" $NetBSD: calendar.1,v 1.7 1995/03/27 08:46:13 glass Exp $ +.\" $OpenBSD: calendar.1,v 1.3 1996/12/05 06:04:37 millert Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 -.\" The Regents of the University of California. All rights reserved. +.\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -14,8 +13,8 @@ .\" 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. +.\" 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. @@ -32,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)calendar.1 8.1 (Berkeley) 6/29/93 +.\" @(#)calendar.1 8.1 (Berkeley) 6/29/93 .\" .Dd June 29, 1993 .Dt CALENDAR 1 @@ -43,8 +42,16 @@ .Sh SYNOPSIS .Nm calendar .Op Fl a +.Op Fl A Ar num +.Op Fl B Ar num +.Oo Fl t Ar dd +.Sm off +.Op . Ar mm Op . Ar year +.Sm on +.Oc +.Op Fl f Ar calendarfile .Sh DESCRIPTION -The +The .Nm calendar utility checks the current directory or the directory specified by the .Dq Ev CALENDAR_DIR @@ -60,20 +67,63 @@ The following options are available: Process the ``calendar'' files of all users and mail the results to them. This requires super-user privileges. +.It Fl A Ar num +print lines from today and next +.Ar num +days (forward, future) +.It Fl B Ar num +print lines from today and previous +.Ar num +days (backward, past) +.It Fl f Pa calendarfile +use +.Pa calendarfile +as default calendar file. +.It Xo Fl t +.Sm off +.Ar dd +.Op . Ar mm Op . Ar year +.Sm on +.Xc +for test purposes only: set date directly to argument values. .El .Pp -Lines should begin with a month and day. +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 +Other lines should begin with a month and day. They may be entered in almost any format, either numeric or as character strings. +If proper locale is set, national months and weekdays +names can be used. A single asterisk (``*'') matches every month. A day without a month matches that day of every week. A month without a day matches the first of that month. 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. +``Easter'', may be followed by an positive or negative integer, is +Easter for this year. +``Paskha'', may be followed by an positive or negative integer, is +Orthodox Easter for this year. +Weekdays may be followed by ``-4'' ... ``+5'' (aliases +last, first, second, third, fourth) for moving events like +``the last Monday in April'' +.Pp By convention, dates followed by an asterisk are not fixed, i.e., change from year to year. .Pp +Day description start after the first <tab> character in the line; +if the line not contains <tab> character, it isn't printed out. +If the first character in the line is a <tab> character, it is treated as +continue of previous description. +.Pp The ``calendar'' file is preprocessed by .Xr cpp 1 , allowing the inclusion of shared files such as company holidays or @@ -87,65 +137,107 @@ Empty lines and lines protected by the C commenting syntax .Pq Li /* ... */ are ignored. .Pp -Some possible calendar entries: +Some possible calendar entries (<tab> characters highlighted by +\fB\et\fR sequence) .Bd -unfilled -offset indent -#include <calendar.usholiday> -#include <calendar.birthday> - -6/15 ... June 15 (if ambiguous, will default to month/day). -Jun. 15 ... June 15. -15 June ... June 15. -Thursday ... Every Thursday. -June ... Every June 1st. -15 * ... 15th of every month. +LANG=C +Easter=Ostern + +#include <calendar.usholiday> +#include <calendar.birthday> + +6/15\fB\et\fRJune 15 (if ambiguous, will default to month/day). +Jun. 15\fB\et\fRJune 15. +15 June\fB\et\fRJune 15. +Thursday\fB\et\fREvery Thursday. +June\fB\et\fREvery June 1st. +15 *\fB\et\fR15th of every month. + +May Sun+2\fB\et\fRsecond Sunday in May (Muttertag) +04/SunLast\fB\et\fRlast Sunday in April, +\fB\et\fRsummer time in Europe +Easter\fB\et\fREaster +Ostern-2\fB\et\fRGood Friday (2 days before Easter) +Paskha\fB\et\fROrthodox Easter .Ed .Sh FILES +.Pp +.Bl -tag -width calendar.christian -compact +.It Pa calendar +file in current directory + +.It Pa ~/.calendar +.Pa calendar +HOME directory. +.Nm calendar +does a chdir into this directory if it exists. + +.It Pa ~/.calendar/calendar +calendar file to use if no calendar file exists in the current directory. + +.It Pa ~/.calendar/nomail +do not send mail if this file exists. +.El + The following default calendar files are provided: .Pp .Bl -tag -width calendar.christian -compact .It Pa calendar.birthday Births and deaths of famous (and not-so-famous) people. + .It Pa calendar.christian Christian holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. + .It Pa calendar.computer Days of special significance to computer people. + .It Pa calendar.history Everything else, mostly U. S. historical events. + .It Pa calendar.holiday Other holidays, including the not-well-known, obscure, and .Em really obscure. + .It Pa calendar.judaic Jewish holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. + .It Pa calendar.music -Musical events, births, and deaths. -Strongly oriented toward rock 'n' roll. +Musical events, births, and deaths. +Strongly oriented toward rock 'n' roll. + .It Pa calendar.usholiday U.S. holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. + +.It Pa calendar.german +German calendar. + +.It Pa calendar.russian +Russian calendar. .El .Sh SEE ALSO .Xr at 1 , .Xr cpp 1 , -.Xr cron 8 +.Xr cron 8 , +.Xr mail 1 .Sh COMPATIBILITY The .Nm calendar program previously selected lines which had the correct date anywhere in the line. This is no longer true, the date is only recognized when it occurs -first on the line. +at the beginning of a line. .Sh HISTORY A .Nm -command appeared in +command appeared in .At v7 . .Sh BUGS .Nm Calendar -doesn't handle events that move around from year to year, i.e., -``the last Monday in April''. +doesn't handle Jewish holidays and moon phases. diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c index fa4d25fa528..3259a568edc 100644 --- a/usr.bin/calendar/calendar.c +++ b/usr.bin/calendar/calendar.c @@ -1,5 +1,4 @@ -/* $OpenBSD: calendar.c,v 1.4 1996/12/04 09:06:00 deraadt Exp $ */ -/* $NetBSD: calendar.c,v 1.8 1995/09/02 05:38:38 jtc Exp $ */ +/* $OpenBSD: calendar.c,v 1.5 1996/12/05 06:04:38 millert Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -35,69 +34,75 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1989, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint #if 0 -static char sccsid[] = "@(#)calendar.c 8.4 (Berkeley) 1/7/95"; +static const char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; +#else +static char rcsid[] = "$OpenBSD: calendar.c,v 1.5 1996/12/05 06:04:38 millert Exp $"; #endif -static char rcsid[] = "$OpenBSD: calendar.c,v 1.4 1996/12/04 09:06:00 deraadt Exp $"; #endif /* not lint */ -#include <sys/param.h> -#include <sys/time.h> -#include <sys/stat.h> -#include <sys/uio.h> -#include <sys/wait.h> - -#include <ctype.h> #include <err.h> #include <errno.h> -#include <fcntl.h> +#include <locale.h> #include <pwd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <tzfile.h> +#include <time.h> #include <unistd.h> #include "pathnames.h" +#include "calendar.h" struct passwd *pw; -int doall; +int doall = 0; +time_t f_time = 0; -void cal __P((void)); -void closecal __P((FILE *)); -int getday __P((char *)); -int getfield __P((char *, char **, int *)); -int getmonth __P((char *)); -int isnow __P((char *)); -FILE *opencal __P((void)); -void settime __P((void)); -void usage __P((void)); +int f_dayAfter = 0; /* days after current date */ +int f_dayBefore = 0; /* days before current date */ int main(argc, argv) int argc; char *argv[]; { - extern int optind; int ch; char *caldir; - while ((ch = getopt(argc, argv, "-a")) != EOF) + (void) setlocale(LC_ALL, ""); + + while ((ch = getopt(argc, argv, "?-af:t:A:B:")) != EOF) switch (ch) { case '-': /* backward contemptible */ case 'a': - if (getuid()) { - errno = EPERM; - err(1, NULL); - } + if (getuid()) + errx(1, strerror(EPERM)); doall = 1; break; + + + case 'f': /* other calendar file */ + calendarFile = optarg; + break; + + case 't': /* other date, undocumented, for tests */ + f_time = Mktime (optarg); + break; + + case 'A': /* days after current date */ + f_dayAfter = atoi(optarg); + break; + + case 'B': /* days before current date */ + f_dayBefore = atoi(optarg); + break; + case '?': default: usage(); @@ -108,7 +113,12 @@ main(argc, argv) if (argc) usage(); - settime(); + /* use current time */ + if (f_time <= 0) + (void)time(&f_time); + + settime(f_time); + if (doall) while ((pw = getpwent()) != NULL) { (void)setegid(pw->pw_gid); @@ -119,310 +129,19 @@ main(argc, argv) (void)seteuid(0); } else if ((caldir = getenv("CALENDAR_DIR")) != NULL) { - if(!chdir(caldir)) - cal(); + if(!chdir(caldir)) + cal(); } else cal(); - exit(0); -} - -void -cal() -{ - register int printing; - register char *p; - FILE *fp; - int ch; - char buf[2048 + 1]; - - if ((fp = opencal()) == NULL) - return; - for (printing = 0; fgets(buf, sizeof(buf), stdin) != NULL;) { - if ((p = strchr(buf, '\n')) != NULL) - *p = '\0'; - else - 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); - } - closecal(fp); -} - -struct iovec header[] = { - "From: ", 6, - NULL, 0, - " (Reminder Service)\nTo: ", 24, - NULL, 0, - "\nSubject: ", 10, - NULL, 0, - "'s Calendar\nPrecedence: bulk\n\n", 30, -}; - -/* 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, -}; -struct tm *tp; -int *cumdays, offset, yrdays; -char dayname[10]; - -void -settime() -{ - time_t now; - - (void)time(&now); - tp = localtime(&now); - if (isleap(tp->tm_year + 1900)) { - yrdays = DAYSPERLYEAR; - cumdays = daytab[1]; - } else { - yrdays = DAYSPERNYEAR; - cumdays = daytab[0]; - } - /* Friday displays Monday's events */ - offset = tp->tm_wday == 5 ? 3 : 1; - header[5].iov_base = dayname; - header[5].iov_len = strftime(dayname, sizeof(dayname), "%A", tp); -} - -/* - * 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(endp) - char *endp; -{ - int day, flags, month, v1, v2; -#define F_ISMONTH 0x01 -#define F_ISDAY 0x02 - flags = 0; - /* didn't recognize anything, skip it */ - if (!(v1 = getfield(endp, &endp, &flags))) - return (0); - if (flags & F_ISDAY || v1 > 12) { - /* found a day */ - day = v1; - month = tp->tm_mon + 1; - } else if (flags & F_ISMONTH) { - month = v1; - /* if no recognizable day, assume the first */ - if (!(day = getfield(endp, &endp, &flags))) - day = 1; - } else { - v2 = getfield(endp, &endp, &flags); - if (flags & F_ISMONTH) { - day = v1; - month = v2; - } else { - /* F_ISDAY set, v2 > 12, or no way to tell */ - month = v1; - /* if no recognizable day, assume the first */ - day = v2 ? v2 : 1; - } - } - if (flags & F_ISDAY) - day = tp->tm_mday + (((day - 1) - tp->tm_wday + 7) % 7); - day = cumdays[month] + day; - - /* if today or today + offset days */ - if (day >= tp->tm_yday && day <= tp->tm_yday + offset) - return (1); - /* if number of days left in this year + days to event in next year */ - if (yrdays - tp->tm_yday + day <= offset) - return (1); - return (0); -} - -int -getfield(p, endp, flags) - char *p, **endp; - int *flags; -{ - int val; - char *start, savech; - - for (; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p) - ; - if (*p == '*') { /* `*' is current month */ - *flags |= F_ISMONTH; - *endp = p+1; - return (tp->tm_mon + 1); - } - if (isdigit(*p)) { - val = strtol(p, &p, 10); /* if 0, it's failure */ - for (; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p) - ; - *endp = p; - return (val); - } - for (start = p; isalpha(*++p);) - ; - savech = *p; - *p = '\0'; - if ((val = getmonth(start)) != 0) - *flags |= F_ISMONTH; - else if ((val = getday(start)) != 0) - *flags |= F_ISDAY; - else { - *p = savech; - return (0); - } - for (*p = savech; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p) - ; - *endp = p; - return (val); -} - -char path[MAXPATHLEN]; - -FILE * -opencal() -{ - int fd, pdes[2]; - - /* open up calendar file as stdin */ - if (!freopen("calendar", "r", stdin)) { - if (doall) - return (NULL); - errx(1, "no calendar file."); - } - if (pipe(pdes) < 0) - return (NULL); - switch (vfork()) { - case -1: /* error */ - (void)close(pdes[0]); - (void)close(pdes[1]); - return (NULL); - case 0: - /* child -- stdin already setup, set stdout to pipe input */ - if (pdes[1] != STDOUT_FILENO) { - (void)dup2(pdes[1], STDOUT_FILENO); - (void)close(pdes[1]); - } - (void)close(pdes[0]); - (void)setuid(geteuid()); - (void)setgid(getegid()); - execl(_PATH_CPP, "cpp", "-P", "-I.", _PATH_INCLUDE, NULL); - warn("execl: %s", _PATH_CPP); - _exit(1); - } - /* parent -- set stdin to pipe output */ - (void)dup2(pdes[0], STDIN_FILENO); - (void)close(pdes[0]); - (void)close(pdes[1]); - - /* not reading all calendar files, just set output to stdout */ - if (!doall) - return (stdout); - - /* set output to a temporary file, so if no output don't send mail */ - (void)snprintf(path, sizeof(path), "%s_calXXXXXX", _PATH_TMP); - if ((fd = mkstemp(path)) < 0) - return (NULL); - return (fdopen(fd, "w+")); -} - -void -closecal(fp) - FILE *fp; -{ - struct stat sbuf; - int nread, pdes[2], status; - char buf[1024]; - - if (!doall) - return; - - (void)rewind(fp); - if (fstat(fileno(fp), &sbuf) || !sbuf.st_size) - goto done; - if (pipe(pdes) < 0) - goto done; - switch (vfork()) { - case -1: /* error */ - (void)close(pdes[0]); - (void)close(pdes[1]); - goto done; - case 0: - /* child -- set stdin to pipe output */ - if (pdes[0] != STDIN_FILENO) { - (void)dup2(pdes[0], STDIN_FILENO); - (void)close(pdes[0]); - } - (void)close(pdes[1]); - (void)setuid(geteuid()); - (void)setgid(getegid()); - execl(_PATH_SENDMAIL, "sendmail", "-i", "-t", "-F", - "\"Reminder Service\"", "-f", "root", NULL); - warn("execl: %s", _PATH_SENDMAIL); - _exit(1); - } - /* 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); - while ((nread = read(fileno(fp), buf, sizeof(buf))) > 0) - (void)write(pdes[1], buf, nread); - (void)close(pdes[1]); -done: (void)fclose(fp); - (void)unlink(path); - while (wait(&status) >= 0) - ; -} - -static char *months[] = { - "jan", "feb", "mar", "apr", "may", "jun", - "jul", "aug", "sep", "oct", "nov", "dec", NULL, -}; - -int -getmonth(s) - register char *s; -{ - register char **p; - - for (p = months; *p; ++p) - if (!strncasecmp(s, *p, 3)) - return ((p - months) + 1); - return (0); + exit(0); } -static char *days[] = { - "sun", "mon", "tue", "wed", "thu", "fri", "sat", NULL, -}; - -int -getday(s) - register char *s; -{ - register char **p; - - for (p = days; *p; ++p) - if (!strncasecmp(s, *p, 3)) - return ((p - days) + 1); - return (0); -} void usage() { - (void)fprintf(stderr, "usage: calendar [-a]\n"); + (void)fprintf(stderr, + "usage: calendar [-a] [-A days] [-B days] [-f calendarfile]\n"); exit(1); } diff --git a/usr.bin/calendar/calendar.h b/usr.bin/calendar/calendar.h new file mode 100644 index 00000000000..068275b58ba --- /dev/null +++ b/usr.bin/calendar/calendar.h @@ -0,0 +1,72 @@ +/* $OpenBSD: calendar.h,v 1.1 1996/12/05 06:04:38 millert Exp $ */ + +/* + * Copyright (c) 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +extern struct passwd *pw; +extern int doall; +extern struct iovec header[]; +extern struct tm *tp; +extern char *calendarFile; +extern char *optarg; + +void cal __P((void)); +void closecal __P((FILE *)); +int getday __P((char *)); +int getdayvar __P((char *)); +int getfield __P((char *, char **, int *)); +int getmonth __P((char *)); +int geteaster __P((char *, int)); +int getpaskha __P((char *, int)); +int easter __P((int)); +int isnow __P((char *, int *, int *, int *)); +FILE *opencal __P((void)); +void settime __P((time_t)); +time_t Mktime __P((char *)); +void usage __P((void)); +void setnnames __P((void)); + +/* some flags */ +#define F_ISMONTH 0x01 /* month (Januar ...) */ +#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 */ + +extern f_dayAfter; /* days after current date */ +extern f_dayBefore; /* days bevore current date */ + +struct fixs { + char *name; + int len; +}; diff --git a/usr.bin/calendar/calendars/calendar.all b/usr.bin/calendar/calendars/calendar.all new file mode 100644 index 00000000000..0a3a75899fe --- /dev/null +++ b/usr.bin/calendar/calendars/calendar.all @@ -0,0 +1,16 @@ +/* + * International and national calendar files + * + * $OpenBSD: calendar.all,v 1.1 1996/12/05 06:04:43 millert Exp $ + */ + +#ifndef _calendar_all_ +#define _calendar_all_ + +#include <calendar.world> +#include <calendar.german> +#include <calendar.usholiday> +#include <calendar.croatian> +#include <calendar.russian> + +#endif /* !_calendar_all_ */ diff --git a/usr.bin/calendar/calendars/calendar.birthday b/usr.bin/calendar/calendars/calendar.birthday index 0cb8cabdbda..866a076e5f8 100644 --- a/usr.bin/calendar/calendars/calendar.birthday +++ b/usr.bin/calendar/calendars/calendar.birthday @@ -1,3 +1,12 @@ +/* + * Birthday + * + * $OpenBSD: calendar.birthday,v 1.2 1996/12/05 06:04:44 millert Exp $ + */ + +#ifndef _calendar_birthday_ +#define _calendar_birthday_ + 01/01 J.D. Salinger born, 1919 01/01 Paul Revere born in Boston, 1735 01/02 Isaac Asimov born in Petrovichi, Russian SFSR (now part of USSR), 1920 @@ -255,3 +264,5 @@ 07/12 Thoreau's Birthday, 1817 08/12 Thomas Mann's Death, 1955 08/20 Leon Trotsky assassinated, 1940 + +#endif /* !_calendar_birthday_ */ diff --git a/usr.bin/calendar/calendars/calendar.christian b/usr.bin/calendar/calendars/calendar.christian index 7f565d66293..5581fc23b48 100644 --- a/usr.bin/calendar/calendars/calendar.christian +++ b/usr.bin/calendar/calendars/calendar.christian @@ -1,16 +1,28 @@ -01/06* Epiphany -02/11* Shrove Tuesday / Mardi Gras (day before Ash Wednesday) -02/08* Ash Wednesday (First day of Lent) -03/19* Palm Sunday (7 days before Easter) -03/23* Maundy Thursday (3 days before Easter) -03/24* Good Friday (2 days before Easter) -03/26* Easter Sunday -05/04* Ascension Day (10 days before Pentecost) -05/14* Pentecost (Whitsunday) -05/15* Whitmonday -05/21* Trinity Sunday (7 days after Pentecost) -05/25* Corpus Christi (11 days after Pentecost) +/* + * Christian + * + * $OpenBSD: calendar.christian,v 1.2 1996/12/05 06:04:44 millert Exp $ + */ + +#ifndef _calendar_christian_ +#define _calendar_christian_ + +01/06* Epiphany +Easter-47 Shrove Tuesday / Mardi Gras (day before Ash Wednesday) +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+39 Ascension Day (10 days before Pentecost) +Easter+49 Pentecost (Whitsunday) +Easter+50 Whitmonday +Easter+56 Trinity Sunday (7 days after Pentecost) +Easter+60 Corpus Christi (11 days after Pentecost) 05/28* Rogation Sunday 10/18 Feast Day of St. Luke -12/03* First Sunday of Advent (4th Sunday before Christmas) +11/SunLast First Sunday of Advent (4th Sunday before Christmas) +12/SunFirst First Sunday of Advent (4th Sunday before Christmas) 12/06 St. Nicholas' Day + +#endif /* !_calendar_christian_ */ diff --git a/usr.bin/calendar/calendars/calendar.computer b/usr.bin/calendar/calendars/calendar.computer index cd0d85da2a7..924d5b5c6e9 100644 --- a/usr.bin/calendar/calendars/calendar.computer +++ b/usr.bin/calendar/calendars/calendar.computer @@ -1,3 +1,12 @@ +/* + * Computer + * + * $OpenBSD: calendar.computer,v 1.2 1996/12/05 06:04:45 millert Exp $ + */ + +#ifndef _calendar_computer_ +#define _calendar_computer_ + 01/01 AT&T officially divests its local Bell companies, 1984 01/01 The Epoch (Time 0 for UNIX systems, Midnight GMT, 1970) 01/03 Apple Computer founded, 1977 @@ -60,3 +69,5 @@ 10/25 DEC announces VAX-11/780 11/04 UNIVAC I program predicts Eisenhower victory based on 7% of votes, 1952 12/08 First Ph.D. awarded by Computer Science Dept, Univ. of Penna, 1965 + +#endif /* !_calendar_computer_ */ diff --git a/usr.bin/calendar/calendars/calendar.croatian b/usr.bin/calendar/calendars/calendar.croatian new file mode 100644 index 00000000000..9c037fe9133 --- /dev/null +++ b/usr.bin/calendar/calendars/calendar.croatian @@ -0,0 +1,12 @@ +/* + * Croatian calendar files + * + * $OpenBSD: calendar.croatian,v 1.1 1996/12/05 06:04:45 millert Exp $ + */ + +#ifndef _calendar_croatian_ +#define _calendar_croatian_ + +#include <hr_HR.ISO_8859-2/calendar.all> + +#endif /* !_calendar_croatian_ */ diff --git a/usr.bin/calendar/calendars/calendar.german b/usr.bin/calendar/calendars/calendar.german new file mode 100644 index 00000000000..45a03c18779 --- /dev/null +++ b/usr.bin/calendar/calendars/calendar.german @@ -0,0 +1,12 @@ +/* + * German calendar file(s) + * + * $OpenBSD: calendar.german,v 1.1 1996/12/05 06:04:46 millert Exp $ + */ + +#ifndef _calendar_german_ +#define _calendar_german_ + +#include <de_DE.ISO_8859-1/calendar.all> + +#endif /* !_calendar_german_ */ diff --git a/usr.bin/calendar/calendars/calendar.history b/usr.bin/calendar/calendars/calendar.history index 9fb2189ed7c..480bddafe86 100644 --- a/usr.bin/calendar/calendars/calendar.history +++ b/usr.bin/calendar/calendars/calendar.history @@ -1,5 +1,14 @@ +/* + * History + * + * $OpenBSD: calendar.history,v 1.2 1996/12/05 06:04:47 millert Exp $ + */ + +#ifndef _calendar_history_ +#define _calendar_history_ + 01/01 Anniversary of the Triumph of the Revolution in Cuba -01/01 Castro expells Cuban President Batista, 1959 +01/01 Castro expels Cuban President Batista, 1959 01/01 Churchill delivers his "Iron Curtain" speech, 1947 01/01 First Rose Bowl; Michigan 49 - Stanford 0, 1902 01/04 Quadrantid meteor shower (look north) @@ -41,7 +50,7 @@ 02/01 First TV soap: Secret Storm, 1954 02/01 Forces lead by Khomeini take over Iran, 1979 02/04 Cybernet inaugurated, 1969 -02/04 Patricia Hearst kidnapped by Symbionese Liberation Army, 1974 +02/04 Patricia Hearst kidnaped by Symbionese Liberation Army, 1974 02/07 Fellowship leaves Lorien (LOTR) 02/08 1963 Revolution Anniversary in Iraq 02/09 -51 degrees F, Vanderbilt MI, 1934 @@ -125,9 +134,9 @@ 04/21 Lyrid meteor shower 04/23 Crowning of King Ellesar (LOTR) 04/23 Hank Aaron hits his first home run, 1954 -04/26 William Shakespeare baptised in Stratford-on-Avon, England, 1564, +04/26 William Shakespeare baptized in Stratford-on-Avon, England, 1564, birthdate unknown -04/27 Magellan killed in Phillippines, 1521 +04/27 Magellan killed in Philippines, 1521 04/29 Zipper patented by Gideon Sindback, 1913 05/01 Beltaine; Feast of the god Bel, sun god 05/03 Anti-war protest disrupts business in Washington, 1971 @@ -162,7 +171,7 @@ 05/30 US Marines sent to Nicaragua, 1912 06/02 Native Americans "granted" citizenship, 1924 06/04 Roquefort cheese developed, 1070 -06/05 Robert Kennedy assasinated, 1968 +06/05 Robert Kennedy assassinated, 1968 06/05 US leaves the Gold Standard, 1933 06/06 First drive-in movie, 1933 06/06 Normandy landing, 1944 @@ -259,7 +268,7 @@ 08/13 Li'l Abner debut, 1934 08/14 Social Security begins in U.S., 1935 08/15 Gandhi's movement obtains independence for Pakistan and India, 1947 -08/15 Hurricane hits Plimoth Plantation, 1635 +08/15 Hurricane hits Plymouth Plantation, 1635 08/16 Roller Coaster patented, 1898 08/17 First public bath opened in N.Y., 1891 08/18 Anti-Cigarette League of America formed @@ -331,9 +340,9 @@ 09/20 The Roxy Theater opens in Hollywood, 1973 09/22 Allied forces form the independent nation West Germany, 1953 09/22 President Lincoln issues the Emancipation Proclamation, 1862 -09/22 Special prosecutor Leon Jeworski subpoenaes President Nixon, 1974 +09/22 Special prosecutor Leon Jeworski subpoenas President Nixon, 1974 09/22 The first Soviet atomic bomb explodes, 1949 -09/23 Phillippine President Ferdinand Marcos declares martial law, 1972 +09/23 Philippine President Ferdinand Marcos declares martial law, 1972 09/23 The New York Knickerbockers becomes the first U.S. Baseball club, 1845 09/23 V.P. Nixon denies campaign fund fraud with his "Checkers" speech, 1952 09/25 Sandra Day O'Connor becomes first woman on US Supreme Court, 1981 @@ -383,7 +392,7 @@ 10/16 Boromir reaches Rivendell (LOTR) 10/17 Council of Elrond (LOTR) 10/18 Boston Shoemakers form first U.S. labor org., 1648 -10/18 Soviets anounce their probe took photos of the Moon's far side, 1959 +10/18 Soviets announce their probe took photos of the Moon's far side, 1959 10/19 Mao Tse-tung establishes the People's Republic of China, 1949 10/19 Napoleon's beaten army begins the long retreat from Moscow, 1812 10/20 "Saturday Night Massacre", 1973 @@ -405,13 +414,13 @@ 10/29 Stock Market Crash, 1929 10/30 Orson Welles' "War of the Worlds" broadcast, 1938 10/31 Luther nails 95 Theses to door of Castle Church, Wittenberg, 1517 -11/01 Austria-Hungary become two seperate nations, 1918 +11/01 Austria-Hungary become two separate nations, 1918 11/01 Puerto Rican nationalists try to kill Truman at the Blair House, 1950 11/02 Luftwaffe completes 57 consecutive nights of bombing of London, 1940 11/02 Two Frenchmen make the first free hot air balloon flight, 1783 11/03 Beef rises to 3 cents a pound, IL, 1837 11/03 Linus Pauling wins Nobel Chemistry Prize, 1954 -11/03 Sputnik II launched, 1957, bearing spacedog Laika +11/03 Sputnik II launched, 1957, bearing space dog Laika 11/04 Iranian militants seize US embassy personnel in Teheran, 1979 11/04 Soviet forces crush the anti-communist revolt in Hungary, 1956 11/05 Guy Fawkes' Plot, 1605 @@ -423,7 +432,7 @@ 11/09 Jack the Ripper kills fifth and final victim, Jane Kelly, 1888 11/09 Margaret Sanger forms American Birth Control League, 1921 11/09 Roosevelt establishes the Civil Works Administration, 1933 -11/10 41 Women arrested in suffragette demonstartions near White House, 1917 +11/10 41 Women arrested in suffragette demonstrations near White House, 1917 11/10 Cpt. Wirz, commandant of Andersonville Prison hanged, 1865 11/10 Henry Stanley asks David Livingston, "Dr. Livingston, I presume?", 1871 11/11 Washington becomes the 42nd state, 1889 @@ -484,3 +493,5 @@ 12/30 First Los Angeles freeway dedicated, 1940 12/31 St. Sylvester in Switzerland 12/31 Winterland closes its doors, 1978 + +#endif /* !_calendar_history_ */ diff --git a/usr.bin/calendar/calendars/calendar.holiday b/usr.bin/calendar/calendars/calendar.holiday index 2f3801d72d2..8ef73f5ab4c 100644 --- a/usr.bin/calendar/calendars/calendar.holiday +++ b/usr.bin/calendar/calendars/calendar.holiday @@ -1,3 +1,12 @@ +/* + * Holiday + * + * $OpenBSD: calendar.holiday,v 1.4 1996/12/05 06:04:48 millert Exp $ + */ + +#ifndef _calendar_holiday_ +#define _calendar_holiday_ + 01/01 Independence Day in Haiti, Sudan 01/01 Universal Fraternity Day in Mozambique 01/02 Ancestry Day in Haiti @@ -23,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 @@ -75,7 +83,6 @@ 03/12 Moshoeshoe's Birthday in Lesotho 03/12 Renovation Day in Gabon 03/13 National Day in Grenada -03/15 Day of the 1848 revolution in Hungary 03/16 Black Press Day; first Black newspaper founded in 1827 03/17 Evacuation Day in Suffolk County, Massachusetts 03/17 St. Patrick's Day @@ -92,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 @@ -103,6 +110,7 @@ 04/02 Malvinas Day in Argentina 04/02 Pascua Florida Day in Florida 04/04 Ching Ming Festival in Hong Kong +04/04 Liberation Day in Hungary 04/04 National Day in Senegal 04/05 Arbor Day in South Korea 04/05 Tomb Sweeping Day in Taiwan @@ -115,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 @@ -134,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) @@ -152,7 +160,7 @@ 05/09 Liberation Day in Czechoslovakia 05/09 Victory Day in Poland, U.S.S.R. 05/10 Confederate Memorial Day in South Carolina -05/10 Mothers Day in Guatamala +05/10 Mothers Day in Guatemala 05/11 Minnesota Day in Minnesota 05/14 Buddhist Holiday (Waisak 2528) in Indonesia 05/14 Independence Day (2 days) in Paraguay @@ -165,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 @@ -238,19 +245,19 @@ 07/09 Independence Day in Argentina 07/10 Independence Day in Bahamas 07/11 National Holiday in the Mongolian People's Republic -07/14 Bastille Day, anniversary of French revolution, 1789 +07/14 Bastille Day 07/14 National Holiday in Monaco 07/15 St. Swithin's Day -07/16 Presidents Day in Botswanna +07/16 Presidents Day in Botswana 07/17 Constitution Day in South Korea -07/17 Public Holiday in Botswanna +07/17 Public Holiday in Botswana 07/18 Constitution Day in Uruguay 07/18 Liberation Day in Nicaragua 07/19 Martyrs Day in Burma 07/20 Independence Day in Colombia 07/21 National Holiday in Belgium 07/22 National Day in Poland -07/23 Eqyptian National Day in Syrian Arab Republic +07/23 Egyptian National Day in Syrian Arab Republic 07/23 Remembrance Day in Papua, New Guinea 07/24 Pioneer Day in Utah 07/24 Simon Bolivar's Day in Ecuador, Venezuela @@ -286,18 +293,18 @@ 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 08/17 Independence Day in Indonesia 08/19 Independence Day in Afghanistan -08/20 Constitution Day in Hungary and birthday of King St. Istvan +08/20 Constitution Day in Hungary 08/23 Liberation Days (2 days) in Romania 08/24 National Flag Day in Liberia 08/25 Constitution Day in Paragual 08/25 Independence Day in Uruguay -08/26 Susan B. Anthony Day in Massachussetts +08/26 Susan B. Anthony Day in Massachusetts 08/26* Bank Holiday in England and Wales 08/27 Liberation Day in Hong Kong 08/28 Heroes Day in Philippines @@ -334,19 +341,18 @@ 09/24 Republic Day in Trinidad, Tobago 09/25 Army Day in Mozambique 09/25 Referendum Day in Rwanda -09/26 National Day in Maldives, Yemem Deomcratic Republic -09/26 Revoluation Anniversary Day in Yemen Arab -09/28 Confucious' Day in Taiwan -09/30 Botswanna Day in Botswanna +09/26 National Day in Maldives, Yemem Democratic Republic +09/26 Revolution Anniversary Day in Yemen Arab +09/28 Confucius' Day in Taiwan +09/30 Botswana Day in Botswana 09/30 First Day of Sukkot 10/01 Armed Forces Day in South Korea 10/01 Independence Day in Nigeria 10/01 Labor Day in Australia 10/01 National Liberation Day (2 days) in China -10/01 Public Holiday in Botswanna +10/01 Public Holiday in Botswana 10/03 National Foundation Day in South Korea 10/03 U.N. Day in Varbados -10/03 Day of German union 10/04 Independence Day in Lesotho 10/06 National Sports Day in Lesotho 10/07 National Heroes Day in Jamaica @@ -369,7 +375,7 @@ 10/12 Our Lady Aparecida Day in Brazil 10/12 Pan American Day in Belize 10/13 St. Edward's Day - Patron saint of England -10/14 National Day in Yemen Arab Repyblic +10/14 National Day in Yemen Arab Republic 10/14 Young People's Day in Zaire 10/14* Thanksgiving Day in Canada 10/15 Evacuation Day in Tunisia @@ -379,8 +385,7 @@ 10/20 Kenyatta Day in Kenya 10/21 Armed Forces Day in Honduras 10/21 Revolution Days (2 days) in Somalia -10/23 Chulalongkron's Day in Thsailand -10/23 Day of the 1956 revolution in Hungary +10/23 Chulalongkron's Day in Thailand 10/24 Independence Day in Zambia 10/24 United Nations Day 10/25 Labor Day in New Zealand @@ -402,8 +407,9 @@ 11/04 Will Rogers Day 11/06 Green March Day in Morocco 11/07 National Revolution Day +11/07 October Revolution Day in Hungary 11/11 Independence Day in Angola -11/11 Rememberance Day in Canada +11/11 Remembrance Day in Canada 11/11 Republic Day in Maldives 11/15 Dynasty Day in Belgium 11/17 Army Day in Zaire @@ -421,7 +427,7 @@ 11/29 Goodwill Day in Liberia 11/29 Liberation Day in Albania 11/29 National Day in Burma -11/30 Independence Day in Barbados, Yemen Deomcratic Republic +11/30 Independence Day in Barbados, Yemen Democratic Republic 11/30 National Day in Benin 11/30 National Heroes Day in Philippines 11/30 St. Andrew's Day @@ -444,7 +450,7 @@ 12/16 Constitution Day in Nepal 12/16 Day of the Covenant in South Africa 12/16 National Day in Bahrain -12/16 Victry Day in Bangladesh +12/16 Victory Day in Bangladesh 12/17 National Day in Bhutan 12/18 Republic Day in Niger 12/23 Victory Day in Egypt @@ -470,14 +476,14 @@ 05/05 Battle of Puebla in Mexico 05/08 Buddha's Birthday in South Korea 05/08 Elections for the National Assembly in Philippines -05/14 Anniversary of the Founding of Guinean Deomcratic Party in Guinea +05/14 Anniversary of the Founding of Guinean Democratic Party in Guinea 05/25 Anniversary of the Revolution of 1810 in Argentina 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 @@ -516,7 +522,7 @@ 08/17 Anniversary of the Death of General San Martin in Argentina 09/09 Anniversary of the Socialist Revolution (2 days) in Bulgaria 09/10 Moon Festival in Taiwan -09/11 Aniversary of military coup in Chile +09/11 Anniversary of military coup in Chile 09/11 Ethiopian New Year in Ethiopia 09/12 Amilcar Cabral's Birthday in Guinea-Bissau 09/14 Battle of San Jacinto in Nicaragua @@ -568,3 +574,5 @@ 12/29 His Majesty, the King's Birthday in Nepal 12/30 Anniversary of the Democratic Republic of Madagascar in Madagascar 12/31 Proclamation of the Republic in Congo + +#endif /* !_calendar_holiday_ */ diff --git a/usr.bin/calendar/calendars/calendar.judaic b/usr.bin/calendar/calendars/calendar.judaic index df39ad56e63..8eb7109637c 100644 --- a/usr.bin/calendar/calendars/calendar.judaic +++ b/usr.bin/calendar/calendars/calendar.judaic @@ -1,3 +1,12 @@ +/* + * Judaic + * + * $OpenBSD: calendar.judaic,v 1.2 1996/12/05 06:04:49 millert Exp $ + */ + +#ifndef _calendar_judaic_ +#define _calendar_judaic_ + 03/08* Fast of Esther (Battle of Purim; 1 day before Purim; fast day) 03/11* Purim (Feast of Lots; 30 days before Pesach) 03/12* Purim (Feast of Lots) @@ -28,3 +37,5 @@ 10/12* Shmini Atzeres/Simchas Torah (Rejoicing of the Law; sabbatical) 12/12* First Day of Chanukah 12/27* Fast of Asara B'Tevet (Babylonians put siege on Jerusalem; fast day) + +#endif /* !_calendar_judaic_ */ diff --git a/usr.bin/calendar/calendars/calendar.music b/usr.bin/calendar/calendars/calendar.music index 90ddf387695..f1afb2da2a0 100644 --- a/usr.bin/calendar/calendars/calendar.music +++ b/usr.bin/calendar/calendars/calendar.music @@ -1,10 +1,19 @@ +/* + * Music + * + * $OpenBSD: calendar.music,v 1.2 1996/12/05 06:04:50 millert Exp $ + */ + +#ifndef _calendar_music_ +#define _calendar_music_ + 01/01 Country Joe McDonald is born in El Monte, California, 1942 01/03 Steven Stills is born in Dallas, 1945 01/04 Jazz great Charlie Mingus dies at 57 in Cuernavaca, Mexico, 1979 01/08 David Bowie (then David Robert Jones) is born in London, 1947 01/09 James Patrick Page (Led Zeppelin) is born in Middlesex, England, 1945 01/10 Blues guitarist Howlin' Wolf dies in Chicago, 1976 -01/10 Jim Croce is born in Phildelphia, 1943 +01/10 Jim Croce is born in Philadelphia, 1943 01/10 Pat Benatar is born in Long Island, 1952 01/10 Rod Stewart is born in Glasgow, Scotland, 1945 01/13 Eric Clapton plays the "Rainbow Concert" in London, 1973 @@ -98,7 +107,7 @@ 07/14 Woodie Guthrie born, 1912 07/16 Cream forms in the U.K., 1966 07/16 Harry Chapin dies on Long Island Expressway, 1981 -07/17 "Yellow Submarine" premieres at the London Pavilon, 1968 +07/17 "Yellow Submarine" premieres at the London Pavilion, 1968 07/20 Carlos Santana is born in Autlan, Mexico, 1947 07/25 Bob Dylan goes electric at the Newport Folk Festival, 1965 07/25 Crosby, Stills, Nash & Young debut at the Fillmore East, 1969 @@ -176,3 +185,5 @@ 12/23 First G&S collaboration, Thespis, 1871 12/28 Edgar Winter is born in Beaumont, Texas, 1946 12/31 Jimi Hendrix introduces the Band of Gypsies at the Fillmore East, 1969 + +#endif /* !_calendar_music_ */ diff --git a/usr.bin/calendar/calendars/calendar.russian b/usr.bin/calendar/calendars/calendar.russian new file mode 100644 index 00000000000..d3463e40433 --- /dev/null +++ b/usr.bin/calendar/calendars/calendar.russian @@ -0,0 +1,12 @@ +/* + * Russian calendar files + * + * $OpenBSD: calendar.russian,v 1.1 1996/12/05 06:04:50 millert Exp $ + */ + +#ifndef _calendar_russian_ +#define _calendar_russian_ + +#include <ru_SU.KOI8-R/calendar.all> + +#endif /* !_calendar_russian_ */ diff --git a/usr.bin/calendar/calendars/calendar.usholiday b/usr.bin/calendar/calendars/calendar.usholiday index f799d0bebb1..a1e8549e2c4 100644 --- a/usr.bin/calendar/calendars/calendar.usholiday +++ b/usr.bin/calendar/calendars/calendar.usholiday @@ -1,31 +1,42 @@ +/* + * USA holiday + * + * $OpenBSD: calendar.usholiday,v 1.2 1996/12/05 06:04:51 millert Exp $ + */ + +#ifndef _calendar_usholiday_ +#define _calendar_usholiday_ + 01/01 New Year's Day 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/29 Thanksgiving Day (Last Thursday in November) +11/ThuFourth Thanksgiving Day (4th Thursday in November) 12/21* Winter Solstice 12/24 Christmas Eve 12/25 Christmas 12/31 New Year's Eve + +#endif /* !_calendar_usholiday_ */ diff --git a/usr.bin/calendar/calendars/calendar.world b/usr.bin/calendar/calendars/calendar.world new file mode 100644 index 00000000000..c59be6f0ded --- /dev/null +++ b/usr.bin/calendar/calendars/calendar.world @@ -0,0 +1,18 @@ +/* + * World wide calendar files, except national calendars + * + * $OpenBSD: calendar.world,v 1.1 1996/12/05 06:04:51 millert Exp $ + */ + +#ifndef _calendar_world_ +#define _calendar_world_ + +#include <calendar.birthday> +#include <calendar.christian> +#include <calendar.computer> +#include <calendar.history> +#include <calendar.holiday> +#include <calendar.judaic> +#include <calendar.music> + +#endif /* !_calendar_world_ */ diff --git a/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.all b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.all new file mode 100644 index 00000000000..4fd9872cbcf --- /dev/null +++ b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.all @@ -0,0 +1,17 @@ +/* + * deutscher Kalender + * + * $OpenBSD: calendar.all,v 1.1 1996/12/05 06:04:52 millert Exp $ + */ + +#ifndef _de_DE_ISO_8859_1_all_ +#define _de_DE_ISO_8859_1_all_ + +#include <de_DE.ISO_8859-1/calendar.feiertag> +#include <de_DE.ISO_8859-1/calendar.geschichte> +#include <de_DE.ISO_8859-1/calendar.kirche> +#include <de_DE.ISO_8859-1/calendar.literatur> +#include <de_DE.ISO_8859-1/calendar.musik> +#include <de_DE.ISO_8859-1/calendar.wissenschaft> + +#endif /* !_de_DE.ISO_8859-1_all_ */ diff --git a/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.feiertag b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.feiertag new file mode 100644 index 00000000000..87e21363b4f --- /dev/null +++ b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.feiertag @@ -0,0 +1,42 @@ +/* + * Feiertage + * + * $OpenBSD: calendar.feiertag,v 1.1 1996/12/05 06:04:53 millert Exp $ + */ + +#ifndef _de_DE_ISO_8859_1_feiertag_ +#define _de_DE_ISO_8859_1_feiertag_ + +LANG=de_DE.ISO_8859-1 + +/* arbeitsfreie staatliche Feiertage */ +01/01 Neujahr +05/01 Maifeiertag +10/03 Tag der deutschen Einheit + +/* arbeitsfreie christliche Feiertage */ +Easter-2 Karfreitag +Easter Ostersonntag +Easter+1 Ostermontag +Easter+49 Pfingstsonntag +Easter+50 Pfingstmontag +Easter+39 Christi Himmelfahrt + +/* Gedenktage - nicht arbeitsfreie Feiertage :-( */ +06/17 Arbeiteraufstand am 17. Juni 1953 +/* ??/?? Befreiung des KZs Auschwitz */ + +/* Jahreszeiten */ +03/21* FrЭhlingsanfang +06/21* Sommeranfang +09/21* Herbstanfang +12/21* Winteranfang + +/* Sommer- und Winterzeit */ +03/SundayLast Anfang der Sommerzeit +10/SundayLast Ende der Sommerzeit + +/* BlumenverkДufer */ +May Sun+2 Muttertag + +#endif /*! _de_DE_ISO_8859_1_feiertag_ */ diff --git a/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.geschichte b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.geschichte new file mode 100644 index 00000000000..0c3a328e2a5 --- /dev/null +++ b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.geschichte @@ -0,0 +1,197 @@ +/* + * deutsche Geschichte + * + * + * Die Angaben wurden Эberwiegend entnommen aus dem Buch: + * + * Fragen an die deutsch Geschichte, Ideen, KrДfte, Entscheidungen von + * 1800 bis zur Gegenwart; historische Ausstellung im ReichstagsgebДude + * in Berlin; Katalog, 16. Auflage, Sonderausgabe - Bonn: Deutscher + * Bundestag, Referat жffentlichkeitsarbeit, 1990 + * + * English Title: Question on German history + * + * ISBN 3-924521-59-X + * + * $OpenBSD: calendar.geschichte,v 1.1 1996/12/05 06:04:53 millert Exp $ + */ + +#ifndef _de_DE_ISO_8859_1_geschichte_ +#define _de_DE_ISO_8859_1_geschichte_ + +LANG=de_DE.ISO_8859-1 + +/* 1800-1933 */ +07/11 GrЭndung der Rheinbundes, 1806 +10/14 Doppelschlacht bei Jena und Auerstedt, 1806 +10/16 VЖlkerschlacht bei Leipzig, 1813 +06/18 Niederlage Napoleons bei Waterloo, 1815 +10/18 Wartburgfest der Deutschen Burschenschaften, 1817 +01/01 Inkrafttreten des Vertrages Эber den deutschen. Zollverein, 1834 +12/07 erste deutsche Eisenbahn zwischen NЭrnberg und FЭrth, 1835 +06 Aufstand der schlesischen Weber, 1844 +12/21 Verabschiedung des Gesetzes Эber die Grundrechte des deutschen + Volkes durch die Frankfurter Nationalversammlung, 1848 +03/27 Annahme der deutschen Reichsverfassung in der Frankfurter + Paulskirche, Wahl von Friedrich Wilhelm IV von Preuъen zum + deutschen Kaiser, 1849 +04/28 Ablehnung der deutschen Kaiserkrone durch den preuъichen KЖnig, 1849 +07/03 Schlacht von KЖniggrДtz +07/13 Emser Depesche, 1870 +07/18 VerkЭndung des Dogmas von der pДpstlichen Unfehlbarkeit + durch das I. Vatikanische Konzil +01/18 Proklamation des deutschen Kaiserreiches in Versailles, 1871 +10/18 Verabschiedung des Sozialistengesetzes durch den Reichstag, 1878 +03/20 Entlassung von Bismarck als Reichskanzler und + preuъischer MinisterprДsident, 1890 +06/21 ErЖffnung des Nord-Ostsee-Kanals, 1895 +01/07 Billigung des BЭrgerlichen Gesetzbuches (BGB) durch den Reichstag, 1896 +01/01 BЭrgerliches Gesetzbuches tritt in Kraft, 1900 +06/28 Ermordung des Жsterreichischen Thronfolgers Erzherzog Franz + Ferdinand durch serbische Nationalisten in Sarajewo, 1914 +07/28 KriegserklДrung жsterreich-Ungarns an Serbien, 1914 +08/01 Deutsche Mobilmachung und KriegserklДrung an Ruъland, 1914 +08/03 Deutsche KriegserklДrung an Frankreich, 1914 +08/04 KriegserklДrung Groъbritaniens an Deutschland, 1914 +08/04 Bewilligung der Kriegskredite im Reichstag, 1914 +08/26 Schlacht bei Tannenberg, 1914 +02/21 Schlacht um Verdun, 1916 +03/08 Ausbruch der Revolution in Ruъland, Abdankung von Zar Nikolaus II, 1917 +04/06 KriegserklДrung der USA an Deutschland +12/15 Waffenstillstand zwisch Ruъland und Deutschland, 1917 +03/03 Frieden von Brest-Litowsk, 1918 +11/03 Matrosenaufstand in Kiel, 1918 +11/09 Ausrufung der Republik durch Scheidemann (SPD), 1918 +02/11 Friedrich Ebert wird ReichsprДsident, Weimar 1919 +06/28 Unterzeichnung des Versailler Vertrages, 1919 +03/21 Volksabstimmung in Oberschlesien, 1921 +04/16 Vertrag von Rapallo, 1922 +06/24 Ermordung von Reichsauъenminister Rathenau, 1922 +01/11 Besetzung des Ruhrgebietes durch Frankreich+Belgien, 1923 +09/10 Eintritt Deutschlands in den VЖlkerbund, 1926 +10/25 Schwarzer Freitag in New York, Beginn der Weltwirtschaftskrise, 1929 + + +/* II. Weltkrieg */ +10/14 Austritt auf dem VЖlkerbund, 1933 +03/16 WiedereinfЭhrung der allgemeinen Wehrpflicht, 1935 +10/25 Deutsch-italienischer Vertrag, Achse Berlin-Rom, 1936 +11/25 Antikominternpakt zwischen Deutschland und Japan, 1936 +01/13 Volksabstimmung im Saargebiet Эber die RЭckfЭhrung ins Reich, 1935 +03/12 Einmarsch deutscher Truppen in жsterreich, 1938 +09/29 MЭnchner Abkommen, 1938 +03/15 Einmarsch deutscher Truppen in die Tschechoslowakei, 1939 +03/23 RЭckgabe des Memelgebietes an Deutschland, 1939 +08/23 Abschluъ des Hitler-Stalin-Paktes, 1939 +09/03 KriegserklДrung Groъbritaniens und Frankreichs an Deutschland, 1939 +04/09 Besetzung DДnemarks, Invasion in Norwegen, 1940 +05/10 Deutscher Angriff auf Belgien, die Niederlande, Luxemburg + und Frankreich, 1940 +06/22 Angriff gegen die Sowjetunion, 1941 +12/11 KriegserklДrung Deutschlands an die USA, 1941 +01/14 Konferenz von Casablanca, 1943 +01/31 Kapitulation der 6. deutschen Armee in Stalingrad, 1943 +06/06 Alliierte Landung in Nordwestfrankreich, 1944 +02/04 Konferenz von Jalta, 4.-11.2. 1945 +04/25 Zusammentreffen von amerikanischen und sowjetischer Truppen + bei Torgau an der Elbe, 1945 +05/08 Bedingungslose Kapitulation von Deutschland, 1945 +07/01 RЭckzug der britischen und amerikanischen Truppen aus + Sachsen, ThЭringen und Mecklenburg, Einmarsch westlicher + Truppen in Berlin, 1945 +07/17 Potsdammer Konferenz, 1945 +09/01 эberfall auf Polen, Beginn des 2. Weltkrieges, 1939 +10/01 VerkЭndigung der Urteile im NЭrnberger + Hauptkriegsverbrecherprozeъ, 1946 +02/25 AuflЖsung der Landes Preuъen durch den Kontrollrat, 1947 +08/06 erster Atombombenabwurf auf Hiroshima, 1945 +08/08 Atombombenabwurf auf Nagasaki, 1945 +04/19 Warschauer Ghetto Aufstand, 1943 +12/07 Japan bombardiert Pearl Harbor, 1941 + +/* Deutschland nach dem 2. Weltkrieg */ +04/11 Attentat auf Dutschke, Studentenunruhen, 1958 +04/26 GAU in Tschernobyl +05/05 Natobeitritt, Wiederbewaffnung, SouverДnitДt der Bundesrepublik, 1955 +05/06 RЭcktritt von Brandt, 1974 +05/16 Wahl von Schmidt (SPD) zum Bundeskanzler, 1974 +05/23 VerkЭndung des Grundgesetzes +05/23 Wahl von Richard von WeizДcker zum BundesprДsidenten, 1984 +06/05 Marshallplan, 1947 +06/20 WДhrungsreform in den Westzonen, 1948 +06/24 Beginn der Berliner Blockade, 1948 +07/01 Wahl von Heinrich LЭbke zum BundesprДsidenten, 1959 +07/01 WДhrungs- und WДhrungsunion, 1990 +08/12 deutsch-sowjetischer Gewaltverzichtsvertrag, Moskau 1970 +08/14 Wahl zum ersten deutschen Bundestag, 1949 +09/03 Vier-MДchte-Abkommen Эber Berlin, 1971 +09/05 EntfЭhrung und Ermordung von ArbeitgeberprДsident Schleyer, EntfЭhrung einer Lufthansa-Maschine nach Mogadischu, 1977 +09/07 DDR-Staatsratsvorsitzender Honecker in der Bundesrepublik, 1987 +09/12 Wahl von Theodor Heuss (FDP) zum BundesprДsidenten, 1949 +09/15 Wahl von Konrad Adenauer (CDU) zum Bundeskanzler, 1949 +09/17 Bruch der Sozialliberalen Koalition, 1982 +09/18 Aufnahme von Bundesrepublik und DDR in die UNO, 1993 +10/01 AblЖsung von Bundeskanzler Schmidt durch Kohl, 1982 +10/23 Volksabstimmung im Saargebiet, 1955 +12/02 Washingtoner Abkommen Эber Bi-Zone, 1946 +12/07 deutsch-polnischer Vertrag, Warschau 1970 +12/10 Friedensnobelpreis fЭr Brandt, 1971 +12/12 NachrЭstungsbeschluъ des NATO-Ministerates, 1979 +12/21 Grundlagenvertrag zwischen DDR und Bundesrepublik, 1972 + + +/* Nationalsozialismus */ +11/09 Hitler-Putsch in MЭnchen/Marsch auf die Feldherrenhalle, 1923 +11/09 Reichskristallnacht, 1938 +09/14 Reichstagswahl: Erdrutsch zugunsten der NSDAP, 1930 +07/31 Reichstagswahl: NSDAP wird stДrkste Fraktion, 1932 +11/06 Reichstagswahl: RЭckgang der NSDAP, 1932 +01/30 Ernennung von Hitler zum Reichskanzler, 1933 +02/27 Reichstagsbrand, 1933 +03/05 Reichstagswahl: Mehrheit fЭr NSDAP+DNVP, 1933 +03/23 Annahme des ErmДchtigungsgesetzes, 1933 +03/31 Erstes Gesetz zur Gleichschaltung der LДnder, 1933 +04/01 Organisierter Boykott jЭdischer GeschДfte, 1933 +04/07 Zweites Gesetz zur Gleichschaltung der LДnder, 1933 +05/02 AuflЖsung der Gewerkschaften, 1933 +06 AuflЖsung aller Parteien auъer NSDAP, 1933 +07/20 Konkordat zwischen Deutschland und dem Vatikan, 1933 +06/30 RЖhm-Putsch, Ausschaltung der SA-FЭhrung, 1934 +09/15 NЭrnberger Gesetze, 1935 +01/08 ErЖffnung der olympischen Spiele in Berlin, 1936 +01/20 Wannseekonferenz, 1942 +04/30 Selbstmord Hitlers, 1945 +07/29 Mussolini geboren, 1883 + +/* Sozialismus */ +01/21 Lenin gestorben, 1924 +06 GrЭndung des Bundes der Kommunisten in London durch Marx+Engels, 1847 +05/23 GrЭndung des Allgemeinen Deutschen Arbeitervereins in Leipzig + unter FЭhrung von Ferdinand Lassalles, 1863 +08/07 GrЭndung der Sozialdemokratischen Arbeiterpartei in Eisenach + unter der FЭhrung von August Begel und Wilhelm Liebknecht, 1869 +04/06 GrЭndung der UnabhДngigen Sozialdemokratischen Partei, Gotha 1917 +11/07 Oktoberrevolution in Ruъland, Putsch der Bolschewisten, 1917 +12/31 GrЭndung der KPD, 1918 +01/15 Ermordung von Rosa Luxemburg und Karl Liebknecht, 1919 +03/05 Tod Stalins, 1953 +03/18 Erste demokratische Volkskammerwahl, 1990 +04/21 Zwangsvereinigung von KPD und SPD zur SED, 1946 +05/14 GrЭndung der Warschauer Paktes, 1955 +06/17 Arbeiteraufstand am 17. Juni 1953 +06/25 Begin der Korea-Krieges, 1950 +08/13 Bau der Berliner Mauer, 1961 +08/21 Einmarsch des Warschauer Pakts in die Tschechoslowakei, 1968 +10/03 Offizielles Ende der DDR :-) +10/07 GrЭndung der DDR 1949 +10/09 Massendemonstration in Leipzig, 1989 +10/14 Kuba-Krise, 1962 +10/18 AblЖsung von Erich Honecker als SED-GeneralsekretДr, 1989 +11/09 Fall der Berliner Mauer, 1989 +09/09 Mao Tse-Tung gestorben im Alter von 82 Jahren, 1976 +11/10 Sowjetischer PrДsident Leonid Breschnew gestorben, Alter 75, 1982 +03/27 Chruschtschow wird sowjetischer PrДsident, 1958 +10/12 Chruschtschow schlДgt wДhrend einer Rede in der UNO mit den + Schuhen auf den Tisch, 1960 + +#endif /* _de_DE_ISO_8859_1_geschichte_ */ diff --git a/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.kirche b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.kirche new file mode 100644 index 00000000000..45470bfc980 --- /dev/null +++ b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.kirche @@ -0,0 +1,32 @@ +/* + * Kirche in Deutschland + * + * $OpenBSD: calendar.kirche,v 1.1 1996/12/05 06:04:54 millert Exp $ + */ + +#ifndef _de_DE_ISO_8859_1_kirche_ +#define _de_DE_ISO_8859_1_kirche_ + +LANG=de_DE.ISO_8859-1 + +Easter-46 Aschermittwoch +Easter-48 Rosenmontag +Easter-7 Palmsonntag + +11/Sun-3 Volkstrauertag (maybe) +11/Sun-2 Volkstrauertag oder Totensonntag +11/Sun-1 1. Advent oder Totensonntag +12/Sun+1 1. oder 2. Advent +12/Sun+2 2. oder 3. Advent +12/Sun+3 3. oder 4. Advent +12/Sun+4 4. Advent (maybe) + +12/06 Nikolaus +12/25 1. Weihnachtstag +12/26 2. Weihnachtstag + +/* Evangelische Kirche */ +11/10 Martin Luther geboren in Eisleben, 1483 +10/31 95 Thesen von Luther, Wittenberg, 1517 + +#endif /* !_de_DE_ISO_8859_1_kirche_ */ diff --git a/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.literatur b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.literatur new file mode 100644 index 00000000000..cc2d4784cbc --- /dev/null +++ b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.literatur @@ -0,0 +1,36 @@ +/* + * Literatur + * + * $OpenBSD: calendar.literatur,v 1.1 1996/12/05 06:04:54 millert Exp $ + */ + +#ifndef _de_DE_ISO_8859_1_literatur_ +#define _de_DE_ISO_8859_1_literatur_ + +LANG=de_DE.ISO_8859-1 + +/* Schriftsteller + + Fontane + Goethe + Grass + Hegel + Heine + Schiller + */ + +01/04 Jakob Grimm geboren, 1785 +04/22 Kant geboren, 1724 +07/03 Franz Kafka geboren, 1883 +08/12 Thomas Mann gestorben, 1955 + + +/* Verlage */ +03/09 "die tageszeitung" als erste tДglich aktualisierte deutsche + Tageszeitung im WWW, 1995, Betatest, vollstДndige Ausgabe +05/05 Schweriner Volkszeitung als erste deutsche Tageszeitung im WWW, 1995 +05/12 "die tageszeitung" offiziell im WWW, 1995 +08/31 Hitler stellt Frankfurter Zeitung ein, 1943 +11/01 Frankfurter Allgemeine Zeitung in Leben gerufen, 1949 + +#endif /* !_de_DE_ISO_8859_1_literatur_ */ diff --git a/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.musik b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.musik new file mode 100644 index 00000000000..bb6050bf063 --- /dev/null +++ b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.musik @@ -0,0 +1,25 @@ +/* + * Musik + * + * $OpenBSD: calendar.musik,v 1.1 1996/12/05 06:04:55 millert Exp $ + */ + +#ifndef _de_DE_ISO_8859_1_musik_ +#define _de_DE_ISO_8859_1_musik_ + +LANG=de_DE.ISO_8859-1 + +/* Klassik */ +02/23 HДndel geboren, 1685 +03/21 J.S. Bach geboren, 1685 +05/07 Johannes Brahms geboren in Hamburg, 1833 +05/22 Johann Sebastian Bach geboren in Eisenach, 1665 +07/28 Bach gestorben, 1750 +10/22 Franz Liszt geboren, 1811 +12/05 Mozart gestorben, 1791 +12/16 Beethoven gestorben, 1770 + +/* Pop */ +09/18 Jimi Hendrix gestorben + +#endif /* !_de_DE_ISO_8859_1_musik_ */ diff --git a/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.wissenschaft b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.wissenschaft new file mode 100644 index 00000000000..3f066dd2964 --- /dev/null +++ b/usr.bin/calendar/calendars/de_DE.ISO_8859-1/calendar.wissenschaft @@ -0,0 +1,19 @@ +/* + * Wissenschaft + * + * $OpenBSD: calendar.wissenschaft,v 1.1 1996/12/05 06:04:55 millert Exp $ + */ + +#ifndef _de_DE_ISO_8859_1_wissenschaft_ +#define _de_DE_ISO_8859_1_wissenschaft_ + +LANG=de_DE.ISO_8859-1 + +04/12 erster Mann im All, Juri Gagarin, 1961 +04/18 Einstein gestorben, 1955 +06/22 Konrad Zuse geboren, 1919, Berlin +10/04 Sputnik 1, erster Satellit im Weltraum, 1957 +12/18 Konrad Zuse gestorben, 1995, HЭnfeld + + +#endif /* ! _de_DE_ISO_8859_1_wissenschaft_ */ diff --git a/usr.bin/calendar/calendars/hr_HR.ISO_8859-2/calendar.all b/usr.bin/calendar/calendars/hr_HR.ISO_8859-2/calendar.all new file mode 100644 index 00000000000..b6ed1efd02e --- /dev/null +++ b/usr.bin/calendar/calendars/hr_HR.ISO_8859-2/calendar.all @@ -0,0 +1,12 @@ +/* + * hrvatski calendar + * + * $OpenBSD: calendar.all,v 1.1 1996/12/05 06:04:56 millert Exp $ + */ + +#ifndef _hr_HR_ISO_8859_2_all +#define _hr_HR_ISO_8859_2_all + +#include <hr_HR.ISO_8859-2/calendar.praznici> + +#endif /* !_hr_HR_ISO_8859_2_all */ diff --git a/usr.bin/calendar/calendars/hr_HR.ISO_8859-2/calendar.praznici b/usr.bin/calendar/calendars/hr_HR.ISO_8859-2/calendar.praznici new file mode 100644 index 00000000000..565cd73aea5 --- /dev/null +++ b/usr.bin/calendar/calendars/hr_HR.ISO_8859-2/calendar.praznici @@ -0,0 +1,37 @@ +/* + * hrvatski praznici + * + * $OpenBSD: calendar.praznici,v 1.1 1996/12/05 06:04:57 millert Exp $ + */ + +#ifndef _hr_HR_ISO_8859_2_praznici +#define _hr_HR_ISO_8859_2_praznici + +LANG=hr_HR.ISO_8859-2 + +/* slobodni dr╬avni praznici */ +01/01 Nova godina +05/01 Prvi maj + + +/* slobodni kr╧Фanski praznici */ +Easter-2 Veliki petak +Easter Uskrs +Easter+1 Uskrsni ponedjeljak +Easter+49 Duhovi +Easter+50 Duhovni ponedjeljak +Easter+39 Uza╧a╧Фe +12/25 Bo╬iФ +12/26 Stjepandan + +/* godi╧nja doba */ +03/21* PoХetak proljeФa +06/21* PoХetak ljeta +09/21* PoХetak jesena +12/21* PoХetak zime + +/* ljetno vrijeme */ +03/SundayLast PoХetak ljetnog vremena +10/SundayLast Kraj ljetnog vremena + +#endif /* !_hr_HR_ISO_8859_2_praznici */ diff --git a/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.all b/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.all new file mode 100644 index 00000000000..b018bb1638e --- /dev/null +++ b/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.all @@ -0,0 +1,15 @@ +/* + * Русский календарь + * + * $OpenBSD: calendar.all,v 1.1 1996/12/05 06:04:58 millert Exp $ + */ + +#ifndef _ru_SU_KOI8_R_all +#define _ru_SU_KOI8_R_all + +#include <ru_SU.KOI8-R/calendar.common> +#include <ru_SU.KOI8-R/calendar.msk> +#include <ru_SU.KOI8-R/calendar.pagan> +#include <ru_SU.KOI8-R/calendar.orthodox> + +#endif /* !_ru_SU_KOI8_R_all */ diff --git a/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.common b/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.common new file mode 100644 index 00000000000..5cd5ec53d90 --- /dev/null +++ b/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.common @@ -0,0 +1,23 @@ +/* + * Русские праздники + * + * $OpenBSD: calendar.common,v 1.1 1996/12/05 06:04:59 millert Exp $ + */ + +#ifndef _ru_SU_KOI8_R_common_ +#define _ru_SU_KOI8_R_common_ + +LANG=ru_SU.KOI8-R + + 1 янв Новый Год +14 янв Старый Новый Год +23 фев День Вооружённых Сил + 8 мар Международный Женский День + 1 апр День Шуток + 1 май Международный День Солидарности Трудящихся + 9 май День Победы + 1 июн День Защиты Детей + 1 сен День Знаний + +#endif /* !_ru_SU_KOI8_R_common_ */ + diff --git a/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.msk b/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.msk new file mode 100644 index 00000000000..fa5f271baad --- /dev/null +++ b/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.msk @@ -0,0 +1,16 @@ +/* + * Перевод часов для московской временной зоны + * + * $OpenBSD: calendar.msk,v 1.1 1996/12/05 06:05:00 millert Exp $ + */ + +#ifndef _ru_SU_KOI8_R_msk_ +#define _ru_SU_KOI8_R_msk_ + +LANG=ru_SU.KOI8-R + +03/SunLast Начало московского летнего времени; часы переводятся вперед +10/SunLast Конец московского летнего времени; часы переводятся назад + +#endif /* !_ru_SU_KOI8_R_msk_ */ + diff --git a/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.orthodox b/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.orthodox new file mode 100644 index 00000000000..fcee226767e --- /dev/null +++ b/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.orthodox @@ -0,0 +1,34 @@ +/* + * Православные праздники + * + * $OpenBSD: calendar.orthodox,v 1.1 1996/12/05 06:05:00 millert Exp $ + */ + +#ifndef _ru_SU_KOI8_R_orthodox_ +#define _ru_SU_KOI8_R_orthodox_ + +LANG=ru_SU.KOI8-R +Paskha=Пасха + +21 сен Рождество Пресвятой Богородицы +28 сен Воздвижение Креста Господня +14 окт Покров Пресвятой Богородицы + 4 дек Введение во храм Пресвятой Богородицы + 7 янв Рождество Христово +19 янв Богоявление или Крещение Господне +15 фев Сретение Господне +Пасха-46 Великий Пост +Пасха-7 Вербное Воскресенье +Пасха-3 Великий Четверг +Пасха-2 Страстная Пятница +Пасха Воскресение Христово +Пасха+39 Вознесение +Пасха+49 Пятидесятница +Пасха+56 Троицин День +Пасха+60 Праздник Тела Христова + 7 апр Благовещение Пресвятой Богородицы +19 авг Преображение Господне +28 авг Успение Пресвятой Богородицы + +#endif /* !_ru_SU_KOI8_R_orthodox_ */ + diff --git a/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.pagan b/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.pagan new file mode 100644 index 00000000000..f2c4ff480f0 --- /dev/null +++ b/usr.bin/calendar/calendars/ru_SU.KOI8-R/calendar.pagan @@ -0,0 +1,42 @@ +/* + * Языческие праздники + * + * $OpenBSD: calendar.pagan,v 1.1 1996/12/05 06:05:01 millert Exp $ + */ + +#ifndef _ru_SU_KOI8_R_pagan_ +#define _ru_SU_KOI8_R_pagan_ + +LANG=ru_SU.KOI8-R +Paskha=Пасха + +21 дек* Зимнее солнцестояние +25 дек Коляда (сдвинутое зимнее солнцестояние) +31 дек Неделя Праотцов + 6 янв День Кащея и Велеса, пост +24 фев День Велеса +29 фев День Кащея + 1 мар День Марены +14 мар Новый Год, Овсень малый +Пасха-47 Масленица +Пасха+7 Красная Горка +Пасха+16 Радуница +20 мар* Весенние равноденствие + 7 апр День Марены (сдвинутое весеннее равноденствие) + 6 май День Дажьбога, Овсень большой +22 май Ярилин День +21 июн* Летнее солнцестояние + 1 июл Русальная Неделя + 7 июл Купала (сдвинутое летнее солнцестояние) +27 июл Отбор жертв Перуну, русалии + 2 авг Перунов День +21 авг День Стрибога +28 авг Успение Златогорки +14 сен День Волха Змеевича +22 сен* Поворот к зиме (осеннее равноденствие) +10 ноя День Макоши +21 ноя День Сварога и Семаргла + 9 дек День Дажьбога и Марены + +#endif /* !_ru_SU_KOI8_R_pagan_ */ + diff --git a/usr.bin/calendar/day.c b/usr.bin/calendar/day.c new file mode 100644 index 00000000000..6e06c97e1f6 --- /dev/null +++ b/usr.bin/calendar/day.c @@ -0,0 +1,489 @@ +/* $OpenBSD: day.c,v 1.1 1996/12/05 06:04:39 millert Exp $ */ + +/* + * Copyright (c) 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1989, 1993\n\ + The Regents of the University of California. All rights reserved.\n"; +#endif /* not lint */ + +#ifndef lint +#if 0 +static const char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; +#else +static char rcsid[] = "$OpenBSD: day.c,v 1.1 1996/12/05 06:04:39 millert Exp $"; +#endif +#endif /* not lint */ + +#include <sys/types.h> +#include <sys/uio.h> + +#include <ctype.h> +#include <err.h> +#include <locale.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <tzfile.h> + +#include "pathnames.h" +#include "calendar.h" + +struct tm *tp; +int *cumdays, offset, 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 *days[] = { + "sun", "mon", "tue", "wed", "thu", "fri", "sat", NULL, +}; + +static 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 */ + + +void setnnames(void) +{ + 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((int)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((int)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); + } + + for (i = 0; i < 12; i++) { + tm.tm_mon = i; + strftime(buf, sizeof(buf), "%b", &tm); + for (l = strlen(buf); + l > 0 && isspace((int)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); + + strftime(buf, sizeof(buf), "%B", &tm); + for (l = strlen(buf); + l > 0 && isspace((int)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); + } +} + +void +settime(now) + time_t now; +{ + tp = localtime(&now); + if (isleap(tp->tm_year + 1900)) { + yrdays = DAYSPERLYEAR; + cumdays = daytab[1]; + } else { + yrdays = DAYSPERNYEAR; + cumdays = daytab[0]; + } + /* Friday displays Monday's events */ + offset = tp->tm_wday == 5 ? 3 : 1; + header[5].iov_base = dayname; + + (void) setlocale(LC_TIME, "C"); + header[5].iov_len = strftime(dayname, sizeof(dayname), "%A", tp); + (void) setlocale(LC_TIME, ""); + + setnnames(); +} + +/* convert Day[/Month][/Year] into unix time (since 1970) + * Day: two digits, Month: two digits, Year: digits + */ +time_t Mktime (date) + char *date; +{ + time_t t; + int len; + struct tm tm; + + (void)time(&t); + tp = localtime(&t); + + len = strlen(date); + tm.tm_sec = 0; + tm.tm_min = 0; + tm.tm_hour = 0; + tm.tm_wday = 0; + tm.tm_mday = tp->tm_mday; + tm.tm_mon = tp->tm_mon; + tm.tm_year = tp->tm_year; + + + /* day */ + *(date+2) = NULL; + tm.tm_mday = atoi(date); + + /* month */ + if (len >= 4) { + *(date+5) = NULL; + tm.tm_mon = atoi(date+3) - 1; + } + + /* Year */ + if (len >= 7) { + tm.tm_year = atoi(date+6); + + /* tm_year up 1900 ... */ + if (tm.tm_year > 1900) + tm.tm_year -= 1900; + } + +#if DEBUG + printf("Mktime: %d %d %d %s\n", (int)mktime(&tm), (int)t, len, + asctime(&tm)); +#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(endp, monthp, dayp, varp) + char *endp; + int *monthp; + int *dayp; + int *varp; +{ + int day, flags = 0, month = 0, v1, v2; + + /* + * CONVENTION + * + * Month: 1-12 + * Monthname: Jan .. Dec + * Day: 1-31 + * Weekday: Mon-Sun + * + */ + + /* 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 + * 'SunayLast' -> ?? + */ + if (flags & F_ISDAY) { +#if 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 '22th' */ + v2 = tp->tm_mday + (((day - 1) - tp->tm_wday + 7) % 7); + + /* (month length - day) / 7 + 1 */ + if (((int)((cumdays[month+1] - + cumdays[month] - v2) / 7) + 1) == -v1) + /* bingo ! */ + day = v2; + + /* set to yesterday */ + else + day = tp->tm_mday - 1; + } + + /* first, second ... +1 ... +5 */ + else { + v1 = day/10; /* offset: +1 (first Sunday) ... */ + 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; + + /* set to yesterday */ + else + day = tp->tm_mday - 1; + } + } + + /* wired */ + else { + day = tp->tm_mday + (((day - 1) - tp->tm_wday + 7) % 7); + *varp = 1; + } + } + + 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]; + *varp = 1; + } + +#if DEBUG + fprintf(stderr, "day2: day %d(%d) yday %d\n", *dayp, day, tp->tm_yday); +#endif + /* if today or today + offset days */ + if (day >= tp->tm_yday - f_dayBefore && + day <= tp->tm_yday + offset + f_dayAfter) + return (1); + + /* if number of days left in this year + days to event in next year */ + if (yrdays - tp->tm_yday + day <= offset + f_dayAfter || + /* a year backward, eg. 6 Jan and 10 days before -> 27. Dec */ + tp->tm_yday + day - f_dayBefore < 0 + ) + return (1); + return (0); +} + + +int +getmonth(s) + register char *s; +{ + register 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(s) + register char *s; +{ + register 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(s) + register char *s; +{ + register int offset; + + + offset = strlen(s); + + + /* Sun+1 or Wednesday-2 + * ^ ^ */ + + /* printf ("x: %s %s %d\n", s, s + offset - 2, offset); */ + switch(*(s + offset - 2)) { + case '-': + return(-(atoi(s + offset - 1))); + break; + case '+': + return(atoi(s + offset - 1)); + break; + } + + + /* + * some aliases: last, first, second, third, fourth + */ + + /* last */ + if (offset > 4 && !strcasecmp(s + offset - 4, "last")) + return(-1); + else if (offset > 5 && !strcasecmp(s + offset - 5, "first")) + return(+1); + else if (offset > 6 && !strcasecmp(s + offset - 6, "second")) + return(+2); + else if (offset > 5 && !strcasecmp(s + offset - 5, "third")) + return(+3); + else if (offset > 6 && !strcasecmp(s + offset - 6, "fourth")) + return(+4); + + + /* no offset detected */ + return(0); +} diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c new file mode 100644 index 00000000000..2974d688e2e --- /dev/null +++ b/usr.bin/calendar/io.c @@ -0,0 +1,342 @@ +/* $OpenBSD: io.c,v 1.1 1996/12/05 06:04:40 millert Exp $ */ + +/* + * Copyright (c) 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1989, 1993\n\ + The Regents of the University of California. All rights reserved.\n"; +#endif /* not lint */ + +#ifndef lint +#if 0 +static const char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; +#else +static char rcsid[] = "$OpenBSD: io.c,v 1.1 1996/12/05 06:04:40 millert Exp $"; +#endif +#endif /* not lint */ + +#include <sys/param.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/uio.h> +#include <sys/wait.h> + +#include <ctype.h> +#include <err.h> +#include <errno.h> +#include <locale.h> +#include <pwd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include "pathnames.h" +#include "calendar.h" + + +char *calendarFile = "calendar"; /* default calendar file */ +char *calendarHome = ".calendar"; /* HOME */ +char *calendarNoMail = "nomail"; /* don't sent mail if this file exist */ + +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}, +}; + + +void +cal() +{ + register int printing; + register char *p; + FILE *fp; + int ch, l; + int month; + int day; + int var; + char buf[2048 + 1]; + + if ((fp = opencal()) == NULL) + return; + for (printing = 0; fgets(buf, sizeof(buf), stdin) != NULL;) { + if ((p = strchr(buf, '\n')) != NULL) + *p = '\0'; + else + while ((ch = getchar()) != '\n' && ch != EOF); + for (l = strlen(buf); + l > 0 && isspace(buf[l - 1]); + l--) + ; + buf[l] = '\0'; + if (buf[0] == '\0') + continue; + if (strncmp(buf, "LANG=", 5) == 0) { + (void) setlocale(LC_ALL, buf + 5); + 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); + 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[30]; + + 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), "%c", &tm); + dbuf[10] = '\0'; + (void)fprintf(fp, "%s%c%s\n", + dbuf + 4/* skip weekdays */, + var ? '*' : ' ', p); + } + } + else if (printing) + fprintf(fp, "%s\n", buf); + } + closecal(fp); +} + +int +getfield(p, endp, flags) + char *p, **endp; + int *flags; +{ + int val, var; + char *start, savech; + + for (; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p) + ; + if (*p == '*') { /* `*' is current month */ + *flags |= F_ISMONTH; + *endp = p+1; + return (tp->tm_mon + 1); + } + if (isdigit(*p)) { + val = strtol(p, &p, 10); /* if 0, it's failure */ + for (; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p) + ; + *endp = p; + return (val); + } + for (start = p; isalpha(*++p);) + ; + + /* Sunday-1 */ + if (*p == '+' || *p == '-') + for(; isdigit(*++p);) + ; + + savech = *p; + *p = '\0'; + + /* Month */ + if ((val = getmonth(start)) != 0) + *flags |= F_ISMONTH; + + /* Day */ + else if ((val = getday(start)) != 0) { + *flags |= F_ISDAY; + + /* variable weekday */ + if ((var = getdayvar(start)) != 0) { + if (var <=5 && var >= -4) + val += var * 10; +#ifdef DEBUG + printf("var: %d\n", var); +#endif + } + } + + /* 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(*p) && !isalpha(*p) && *p != '*'; ++p) + ; + *endp = p; + return (val); +} + +char path[MAXPATHLEN]; + +FILE * +opencal() +{ + int fd, pdes[2]; + struct stat sbuf; + + /* open up calendar file as stdin */ + if (!freopen(calendarFile, "r", stdin)) { + if (doall) { + if (chdir(calendarHome) != 0) + return (NULL); + if (stat(calendarNoMail, &sbuf) == 0) + return (NULL); + if (!freopen(calendarFile, "r", stdin)) + return (NULL); + } else { + chdir(getenv("HOME")); + if (!(chdir(calendarHome) == 0 && + freopen(calendarFile, "r", stdin))) + errx(1, "no calendar file: ``%s'' or ``~/%s/%s\n", calendarFile, calendarHome, calendarFile); + } + } + if (pipe(pdes) < 0) + return (NULL); + switch (vfork()) { + case -1: /* error */ + (void)close(pdes[0]); + (void)close(pdes[1]); + return (NULL); + case 0: + /* child -- stdin already setup, set stdout to pipe input */ + if (pdes[1] != STDOUT_FILENO) { + (void)dup2(pdes[1], STDOUT_FILENO); + (void)close(pdes[1]); + } + (void)close(pdes[0]); + (void)setuid(geteuid()); + (void)setgid(getegid()); + execl(_PATH_CPP, "cpp", "-P", "-I.", _PATH_INCLUDE, NULL); + warn(_PATH_CPP); + _exit(1); + } + /* parent -- set stdin to pipe output */ + (void)dup2(pdes[0], STDIN_FILENO); + (void)close(pdes[0]); + (void)close(pdes[1]); + + /* not reading all calendar files, just set output to stdout */ + if (!doall) + return (stdout); + + /* set output to a temporary file, so if no output don't send mail */ + (void)snprintf(path, sizeof(path), "%s/_calXXXXXX", _PATH_TMP); + if ((fd = mkstemp(path)) < 0) + return (NULL); + return (fdopen(fd, "w+")); +} + +void +closecal(fp) + FILE *fp; +{ + struct stat sbuf; + int nread, pdes[2], status; + char buf[1024]; + + if (!doall) + return; + + (void)rewind(fp); + if (fstat(fileno(fp), &sbuf) || !sbuf.st_size) + goto done; + if (pipe(pdes) < 0) + goto done; + switch (vfork()) { + case -1: /* error */ + (void)close(pdes[0]); + (void)close(pdes[1]); + goto done; + case 0: + /* child -- set stdin to pipe output */ + if (pdes[0] != STDIN_FILENO) { + (void)dup2(pdes[0], STDIN_FILENO); + (void)close(pdes[0]); + } + (void)close(pdes[1]); + (void)setuid(geteuid()); + (void)setgid(getegid()); + execl(_PATH_SENDMAIL, "sendmail", "-i", "-t", "-F", + "\"Reminder Service\"", "-f", "root", NULL); + warn(_PATH_SENDMAIL); + _exit(1); + } + /* 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); + while ((nread = read(fileno(fp), buf, sizeof(buf))) > 0) + (void)write(pdes[1], buf, nread); + (void)close(pdes[1]); +done: (void)fclose(fp); + (void)unlink(path); + while (wait(&status) >= 0); +} diff --git a/usr.bin/calendar/ostern.c b/usr.bin/calendar/ostern.c new file mode 100644 index 00000000000..3d27000b169 --- /dev/null +++ b/usr.bin/calendar/ostern.c @@ -0,0 +1,130 @@ +/* $OpenBSD: ostern.c,v 1.1 1996/12/05 06:04:40 millert Exp $ */ + +/* + * Copyright (c) 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: ostern.c,v 1.1 1996/12/05 06:04:40 millert Exp $ + */ + +#ifndef lint +static char rcsid[] = "$OpenBSD: ostern.c,v 1.1 1996/12/05 06:04:40 millert Exp $"; +#endif /* not lint */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include "calendar.h" + +/* return year day for Easter */ + +int easter (year) + int year; /* 0 ... abcd, NOT since 1900 */ +{ + + int e_a, e_b, e_c, e_d, e_e,e_f, e_g, e_h, e_i, e_k, + e_l, e_m, e_n, e_p, e_q; + + /* silly, but it works */ + e_a = year % 19; + e_b = year / 100; + e_c = year % 100; + + e_d = e_b / 4; + e_e = e_b % 4; + e_f = (e_b + 8) / 25; + e_g = (e_b + 1 - e_f) / 3; + e_h = ((19 * e_a) + 15 + e_b - (e_d + e_g)) % 30; + e_i = e_c / 4; + e_k = e_c % 4; + e_l = (32 + 2 * e_e + 2 * e_i - (e_h + e_k)) % 7; + e_m = (e_a + 11 * e_h + 22 * e_l) / 451; + e_n = (e_h + e_l + 114 - (7 * e_m)) / 31; + e_p = (e_h + e_l + 114 - (7 * e_m)) % 31; + e_p = e_p + 1; + + e_q = 31 + 28; + + if (e_k == 0 && e_c != 0) + e_q += 1; + + if (e_n == 4) + e_q += 31; + + e_q += e_p; + +#if DEBUG + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", e_a , e_b , e_c , e_d , e_e , e_f , e_g , e_h , e_i , e_k , e_l , e_m , e_n , e_p , e_q); +#endif + + return (e_q); +} + +/* 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(s, year) + char *s; + int year; +{ + register int offset = 0; + extern struct fixs neaster; + +#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 new file mode 100644 index 00000000000..6844b59813e --- /dev/null +++ b/usr.bin/calendar/paskha.c @@ -0,0 +1,99 @@ +/* $OpenBSD: paskha.c,v 1.1 1996/12/05 06:04:41 millert Exp $ */ + +/* + * Copyright (C) 1993-1996 by Andrey A. Chernov, Moscow, Russia. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char rcsid[] = "$OpenBSD: paskha.c,v 1.1 1996/12/05 06:04:41 millert Exp $"; +#endif /* not lint */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include "calendar.h" + +#define PASKHA "paskha" +#define PASKHALEN (sizeof(PASKHA) - 1) + +/* return year day for Orthodox Easter using Gauss formula */ +/* (old style result) */ + +static int +paskha (R) +int R; /*year*/ +{ + int a, b, c, d, e; + static int x = 15; + static int y = 6; + extern int *cumdays; + + 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(s, year) + char *s; + int year; +{ + int offset; + extern struct fixs npaskha; + + 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 */); +} diff --git a/usr.bin/calendar/pathnames.h b/usr.bin/calendar/pathnames.h index c4893978898..6ce7096901b 100644 --- a/usr.bin/calendar/pathnames.h +++ b/usr.bin/calendar/pathnames.h @@ -1,5 +1,4 @@ -/* $OpenBSD: pathnames.h,v 1.2 1996/06/26 05:31:46 deraadt Exp $ */ -/* $NetBSD: pathnames.h,v 1.3 1995/03/27 08:46:15 glass Exp $ */ +/* $OpenBSD: pathnames.h,v 1.3 1996/12/05 06:04:41 millert Exp $ */ /* * Copyright (c) 1989, 1993 @@ -39,5 +38,6 @@ #include <paths.h> #define _PATH_CPP "/usr/bin/cpp" + /* XXX -- fix when cpp parses arguments rationally */ #define _PATH_INCLUDE "-I/usr/share/calendar" |