diff options
author | mpp <mpp@FreeBSD.org> | 1997-02-02 07:37:46 +0000 |
---|---|---|
committer | mpp <mpp@FreeBSD.org> | 1997-02-02 07:37:46 +0000 |
commit | 0e1fbde21d431dbe82b72ca4534d991673829d31 (patch) | |
tree | 5ee48a75c1e6c78ea86065ade0d631e8b2ab95bb /usr.bin | |
parent | e6b42ddfe105d779426250806c5071a8cfd39fec (diff) | |
download | FreeBSD-src-0e1fbde21d431dbe82b72ca4534d991673829d31.zip FreeBSD-src-0e1fbde21d431dbe82b72ca4534d991673829d31.tar.gz |
Fix calendar so that it doesn't report strange results on
Jan 1st (and probably other dates as well) for some variable
events. E.g.
01/SunThird whatever...
Was being printed as:
Jan 0 Whatever
when calendar was run on January 1st.
Closes PR#2461.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/calendar/day.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/calendar/day.c b/usr.bin/calendar/day.c index 14b9a14..6000438 100644 --- a/usr.bin/calendar/day.c +++ b/usr.bin/calendar/day.c @@ -327,8 +327,11 @@ isnow(endp, monthp, dayp, varp) day = v2; /* set to yesterday */ - else + else { day = tp->tm_mday - 1; + if (day == 0) + return (0); + } } /* first, second ... +1 ... +5 */ @@ -344,8 +347,11 @@ isnow(endp, monthp, dayp, varp) day = v2; /* set to yesterday */ - else + else { day = tp->tm_mday - 1; + if (day == 0) + return (0); + } } } |