=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cal/cal.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- src/usr.bin/cal/cal.c 1997/01/15 23:42:15 1.4 +++ src/usr.bin/cal/cal.c 1998/03/30 06:59:23 1.5 @@ -1,4 +1,4 @@ -/* $OpenBSD: cal.c,v 1.4 1997/01/15 23:42:15 millert Exp $ */ +/* $OpenBSD: cal.c,v 1.5 1998/03/30 06:59:23 deraadt Exp $ */ /* $NetBSD: cal.c,v 1.6 1995/03/26 03:10:24 glass Exp $ */ /* @@ -47,7 +47,7 @@ #if 0 static char sccsid[] = "@(#)cal.c 8.4 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: cal.c,v 1.4 1997/01/15 23:42:15 millert Exp $"; +static char rcsid[] = "$OpenBSD: cal.c,v 1.5 1998/03/30 06:59:23 deraadt Exp $"; #endif #endif /* not lint */ @@ -59,6 +59,7 @@ #include #include #include +#include #include #define THURSDAY 4 /* for reformation */ @@ -109,7 +110,7 @@ /* leap year -- account for gregorian reformation in 1752 */ #define leap_year(yr) \ ((yr) <= 1752 ? !((yr) % 4) : \ - !((yr) % 4) && ((yr) % 100) || !((yr) % 400)) + (!((yr) % 4) && ((yr) % 100)) || !((yr) % 400)) /* number of centuries since 1700, not inclusive */ #define centuries_since_1700(yr) \ @@ -174,7 +175,7 @@ case 0: (void)time(&now); local_time = localtime(&now); - year = local_time->tm_year + 1900; + year = local_time->tm_year + TM_YEAR_BASE; if (!yflag) month = local_time->tm_mon + 1; break; @@ -376,7 +377,8 @@ return; } if (julian) { - if (val = day / 100) { + val = day / 100; + if (val) { day %= 100; *p++ = val + '0'; display = 1;