diff options
author | 2019-02-01 16:22:53 +0000 | |
---|---|---|
committer | 2019-02-01 16:22:53 +0000 | |
commit | db80911467f7110360ff15191894d8907ecd847b (patch) | |
tree | 8772058d81b44d19047350831064023e2e9ec6bd | |
parent | Complete athn(4) noisefloor calibration code and enable it. (diff) | |
download | wireguard-openbsd-db80911467f7110360ff15191894d8907ecd847b.tar.xz wireguard-openbsd-db80911467f7110360ff15191894d8907ecd847b.zip |
Fix regresion that prevented -A0 from working as before.
This can be used to disable the default behavior of reporting events
for the weekend on a Friday.
-rw-r--r-- | usr.bin/calendar/calendar.c | 10 | ||||
-rw-r--r-- | usr.bin/calendar/calendar.h | 3 | ||||
-rw-r--r-- | usr.bin/calendar/day.c | 4 |
3 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c index 25687e7e50d..ad82a94707c 100644 --- a/usr.bin/calendar/calendar.c +++ b/usr.bin/calendar/calendar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: calendar.c,v 1.36 2019/01/29 20:08:56 millert Exp $ */ +/* $OpenBSD: calendar.c,v 1.37 2019/02/01 16:22:53 millert Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -58,8 +58,9 @@ int daynames = 0; time_t f_time = 0; int bodun_always = 0; -int f_dayAfter = 0; /* days after current date */ -int f_dayBefore = 0; /* days before current date */ +int f_dayAfter = 0; /* days after current date */ +int f_dayBefore = 0; /* days before current date */ +int f_Setday = 0; /* calendar invoked with -A or -B */ struct specialev spev[NUMEV]; @@ -100,12 +101,15 @@ main(int argc, char *argv[]) f_dayAfter = strtonum(optarg, 0, INT_MAX, &errstr); if (errstr) errx(1, "-A %s: %s", optarg, errstr); + f_Setday = 1; break; case 'B': /* days before current date */ f_dayBefore = strtonum(optarg, 0, INT_MAX, &errstr); if (errstr) errx(1, "-B %s: %s", optarg, errstr); + if (f_dayBefore != 0) + f_Setday = 1; break; case 'w': diff --git a/usr.bin/calendar/calendar.h b/usr.bin/calendar/calendar.h index b6e27d0a592..c45ed719001 100644 --- a/usr.bin/calendar/calendar.h +++ b/usr.bin/calendar/calendar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: calendar.h,v 1.16 2019/01/29 20:08:56 millert Exp $ */ +/* $OpenBSD: calendar.h,v 1.17 2019/02/01 16:22:53 millert Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -103,6 +103,7 @@ void setnnames(void); extern int f_dayAfter; /* days after current date */ extern int f_dayBefore; /* days before current date */ +extern int f_Setday; /* calendar invoked with -A or -B */ /* Special events; see also setnnames() in day.c */ /* '=' is not a valid character in a special event name */ diff --git a/usr.bin/calendar/day.c b/usr.bin/calendar/day.c index 5103566576a..c94a844dd00 100644 --- a/usr.bin/calendar/day.c +++ b/usr.bin/calendar/day.c @@ -1,4 +1,4 @@ -/* $OpenBSD: day.c,v 1.35 2019/01/29 20:08:56 millert Exp $ */ +/* $OpenBSD: day.c,v 1.36 2019/02/01 16:22:53 millert Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -166,7 +166,7 @@ settime(time_t *now) cumdays = daytab[0]; /* Friday displays Monday's events */ offset = tp->tm_wday == 5 ? 3 : 1; - if (f_dayAfter || f_dayBefore) + if (f_Setday) offset = 0; /* Except not when range is set explicitly */ header[5].iov_base = dayname; |