diff --git a/usr.bin/calendar/calendar.1 b/usr.bin/calendar/calendar.1 index eeb3018366b2..11b3e026820f 100644 --- a/usr.bin/calendar/calendar.1 +++ b/usr.bin/calendar/calendar.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: calendar.1,v 1.8 1997/08/26 19:58:10 thorpej Exp $ +.\" $NetBSD: calendar.1,v 1.9 1997/10/18 12:27:31 lukem Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -40,7 +40,7 @@ .Nm calendar .Nd reminder service .Sh SYNOPSIS -.Nm calendar +.Nm .Op Fl a .Op Fl f Ar file .Op Fl l Ar days @@ -48,7 +48,7 @@ .Op Fl d Ar MMDD[[YY]YY] .Sh DESCRIPTION The -.Nm calendar +.Nm utility processes text files and displays lines that match certain dates. .Pp The following options are available: @@ -80,7 +80,7 @@ one) from the specified date and display their entries as well. Causes the program to add the specified number of days to the ``look ahead'' number if and only if the day specified is a Friday. The default value is two, which causes -.Nm calendar +.Nm to print entries through the weekend on Fridays. .El .Pp @@ -157,7 +157,7 @@ so that roving holidays are set correctly for the current year. .Xr cron 8 .Sh COMPATIBILITY The -.Nm calendar +.Nm 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 @@ -168,6 +168,6 @@ A command appeared in .At v7 . .Sh BUGS -.Nm Calendar +.Nm doesn't handle events that move around from year to year, i.e., ``the last Monday in April''. diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c index e92941a03963..7db119d797a0 100644 --- a/usr.bin/calendar/calendar.c +++ b/usr.bin/calendar/calendar.c @@ -1,4 +1,4 @@ -/* $NetBSD: calendar.c,v 1.10 1997/08/26 19:58:11 thorpej Exp $ */ +/* $NetBSD: calendar.c,v 1.11 1997/10/18 12:27:37 lukem Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -33,17 +33,17 @@ * SUCH DAMAGE. */ +#include #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1989, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__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"; #endif -static char rcsid[] = "$NetBSD: calendar.c,v 1.10 1997/08/26 19:58:11 thorpej Exp $"; +__RCSID("$NetBSD: calendar.c,v 1.11 1997/10/18 12:27:37 lukem Exp $"); #endif /* not lint */ #include @@ -85,6 +85,7 @@ int getfield __P((char *, char **, int *)); void getmmdd(struct tm *tp, char *ds); int getmonth __P((char *)); int isnow __P((char *)); +int main __P((int, char **)); FILE *opencal __P((void)); void settime __P((void)); void usage __P((void)); @@ -98,13 +99,13 @@ main(argc, argv) int ch; char *caldir; - while ((ch = getopt(argc, argv, "-ad:f:l:w:")) != EOF) + while ((ch = getopt(argc, argv, "-ad:f:l:w:")) != -1) switch (ch) { case '-': /* backward contemptible */ case 'a': if (getuid()) { errno = EPERM; - err(1, NULL); + err(1, "%s", ""); } doall = 1; break; @@ -150,8 +151,8 @@ main(argc, argv) void cal() { - register int printing; - register char *p; + int printing; + char *p; FILE *fp; int ch; char buf[2048 + 1]; @@ -174,19 +175,19 @@ cal() } struct iovec header[] = { - "From: ", 6, - NULL, 0, - " (Reminder Service)\nTo: ", 24, - NULL, 0, - "\nSubject: ", 10, - NULL, 0, - "'s Calendar\nPrecedence: bulk\n\n", 30, + { "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, + { 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; @@ -415,9 +416,9 @@ static char *months[] = { int getmonth(s) - register char *s; + char *s; { - register char **p; + char **p; for (p = months; *p; ++p) if (!strncasecmp(s, *p, 3)) @@ -431,9 +432,9 @@ static char *days[] = { int getday(s) - register char *s; + char *s; { - register char **p; + char **p; for (p = days; *p; ++p) if (!strncasecmp(s, *p, 3)) @@ -467,7 +468,6 @@ getmmdd(struct tm *tp, char *ds) extern char *__progname; int ok = FALSE; struct tm ttm; - char *t; ttm = *tp; ttm.tm_isdst = -1;