summaryrefslogtreecommitdiffstats
path: root/usr.bin/calendar/calendar.c
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>2002-06-13 21:20:56 +0000
committergrog <grog@FreeBSD.org>2002-06-13 21:20:56 +0000
commitfb4608bacb1fa1b6e9fdd02c47d034721446b29f (patch)
tree81000a9a25491407feed68f791095ce654acdc77 /usr.bin/calendar/calendar.c
parent0c70e00d001ba34a2608c2b21750c330782350bd (diff)
downloadFreeBSD-src-fb4608bacb1fa1b6e9fdd02c47d034721446b29f.zip
FreeBSD-src-fb4608bacb1fa1b6e9fdd02c47d034721446b29f.tar.gz
Add two new options:
-W is like -A (number of days in the future to consider, but also specifies that we don't want special treatment at weekends. -F changes our notion of "Friday" (the day before the weekend). Arguably, calendar(1) is broken to have special treatment of weekends by default, but this method maintains POLA.
Diffstat (limited to 'usr.bin/calendar/calendar.c')
-rw-r--r--usr.bin/calendar/calendar.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c
index dc5b6d9..4f26362 100644
--- a/usr.bin/calendar/calendar.c
+++ b/usr.bin/calendar/calendar.c
@@ -64,6 +64,7 @@ time_t f_time = 0;
int f_dayAfter = 0; /* days after current date */
int f_dayBefore = 0; /* days before current date */
+int Friday = 5; /* day before weekend */
int
main(argc, argv)
@@ -74,7 +75,7 @@ main(argc, argv)
(void) setlocale(LC_ALL, "");
- while ((ch = getopt(argc, argv, "-af:t:A:B:")) != -1)
+ while ((ch = getopt(argc, argv, "-af:t:A:B:F:W:")) != -1)
switch (ch) {
case '-': /* backward contemptible */
case 'a':
@@ -94,6 +95,10 @@ main(argc, argv)
f_time = Mktime (optarg);
break;
+ case 'W': /* we don't need no steenking Fridays */
+ Friday = -1;
+
+ /* FALLTHROUGH */
case 'A': /* days after current date */
f_dayAfter = atoi(optarg);
break;
@@ -102,6 +107,10 @@ main(argc, argv)
f_dayBefore = atoi(optarg);
break;
+ case 'F':
+ Friday = atoi(optarg);
+ break;
+
case '?':
default:
usage();
@@ -137,7 +146,8 @@ void
usage()
{
(void)fprintf(stderr,
- "usage: calendar [-a] [-A days] [-B days] [-f calendarfile] [-t dd[.mm[.year]]]\n");
+ "usage: calendar [-a] [-A days] [-W days] [-F friday] [-B days]\n"
+ "\t[-f calendarfile] [-t dd[.mm[.year]]]\n");
exit(1);
}
OpenPOWER on IntegriCloud