diff -up calendar-1.25/calendar.c.orig calendar-1.25/calendar.c --- calendar-1.25/calendar.c.orig 2005-11-16 06:45:11.000000000 -1000 +++ calendar-1.25/calendar.c 2009-02-12 12:47:01.000000000 -1000 @@ -49,14 +49,12 @@ static const char rcsid[] = "$OpenBSD: c #include #include #include -#include #include #include #include #include #include #include -#include #include #include "pathnames.h" @@ -184,10 +182,6 @@ main(int argc, char *argv[]) continue; case 0: /* child */ (void)setlocale(LC_ALL, ""); - if (setusercontext(NULL, pw, pw->pw_uid, - LOGIN_SETALL ^ LOGIN_SETLOGIN)) - err(1, "unable to set user context (uid %u)", - pw->pw_uid); if (acstat) { if (chdir(pw->pw_dir) || stat(calendarFile, &sbuf) != 0 || diff -up calendar-1.25/calendar.h.orig calendar-1.25/calendar.h --- calendar-1.25/calendar.h.orig 2005-08-09 02:32:58.000000000 -1000 +++ calendar-1.25/calendar.h 2009-02-12 15:35:24.000000000 -1000 @@ -29,6 +29,7 @@ * SUCH DAMAGE. */ +#include extern struct passwd *pw; extern int doall; @@ -111,7 +112,7 @@ extern int f_SetdayAfter; /* calendar in /* calendars */ extern enum calendars { GREGORIAN = 0, JULIAN, LUNAR } calendar; -extern u_long julian; +extern unsigned long julian; #define NUMEV 3 /* Total number of such special events */ extern struct specialev spev[NUMEV]; @@ -121,3 +122,5 @@ extern struct specialev spev[NUMEV]; * (e.g. by using named pipes) */ #define USERTIMEOUT 20 + +#define SECSPERDAY 86400 diff -up calendar-1.25/day.c.orig calendar-1.25/day.c --- calendar-1.25/day.c.orig 2008-04-12 14:22:17.000000000 -1000 +++ calendar-1.25/day.c 2009-02-12 15:41:08.000000000 -1000 @@ -53,7 +53,6 @@ static const char rcsid[] = "$OpenBSD: d #include #include #include -#include #include "pathnames.h" #include "calendar.h" @@ -170,7 +169,7 @@ settime(time_t *now) tp->tm_isdst = 0; tp->tm_hour = 12; *now = mktime(tp); - if (isleap(tp->tm_year + TM_YEAR_BASE)) + if (__isleap(tp->tm_year + TM_YEAR_BASE)) cumdays = daytab[1]; else cumdays = daytab[0]; @@ -301,7 +300,8 @@ isnow(char *endp, int bodun) /* adjust bodun rate */ if (bodun && !bodun_always) - bodun = !arc4random_uniform(3); + srandom(3); + bodun = random(); /* Easter or Easter depending days */ if (flags & F_SPECIAL) @@ -452,7 +452,7 @@ isnow(char *endp, int bodun) } v2 = day - tp->tm_yday; if ((v2 > v1) || (v2 < 0)) { - if ((v2 += isleap(tp->tm_year + TM_YEAR_BASE) ? 366 : 365) + if ((v2 += __isleap(tp->tm_year + TM_YEAR_BASE) ? 366 : 365) <= v1) tmtmp.tm_year++; else if(!bodun || (day - tp->tm_yday) != -1) @@ -688,7 +688,7 @@ variable_weekday(int *day, int month, in int *cumdays; int day1; - if (isleap(year)) + if (__isleap(year)) cumdays = daytab[1]; else cumdays = daytab[0]; diff -up calendar-1.25/io.c.orig calendar-1.25/io.c --- calendar-1.25/io.c.orig 2007-10-17 10:10:44.000000000 -1000 +++ calendar-1.25/io.c 2009-02-12 12:48:11.000000000 -1000 @@ -59,7 +59,6 @@ static const char rcsid[] = "$OpenBSD: i #include #include #include -#include #include #include "pathnames.h" @@ -82,7 +81,7 @@ void cal(void) { int ch, l, i, bodun = 0, bodun_maybe = 0, var, printing; - struct event *events, *cur_evt, *ev1, *tmp; + struct event *events = NULL, *cur_evt = NULL, *ev1 = NULL, *tmp = NULL; char buf[2048 + 1], *prefix = NULL, *p; struct match *m; FILE *fp; diff -up calendar-1.25/ostern.c.orig calendar-1.25/ostern.c --- calendar-1.25/ostern.c.orig 2005-11-16 06:45:11.000000000 -1000 +++ calendar-1.25/ostern.c 2009-02-12 15:35:55.000000000 -1000 @@ -34,7 +34,6 @@ static const char rcsid[] = "$OpenBSD: o #include #include -#include #include "calendar.h" @@ -65,7 +64,7 @@ easter(int year) /* 0 ... abcd, NOT sinc e_p = e_p + 1; e_q = 31 + 28 + e_p; - if (isleap(year)) + if (__isleap(year)) e_q++; if (e_n == 4) diff -up calendar-1.25/paskha.c.orig calendar-1.25/paskha.c --- calendar-1.25/paskha.c.orig 2005-11-16 06:45:11.000000000 -1000 +++ calendar-1.25/paskha.c 2009-02-12 15:36:27.000000000 -1000 @@ -31,7 +31,7 @@ static const char rcsid[] = "$OpenBSD: p #endif /* not lint */ #include -#include +#include #include "calendar.h" @@ -52,7 +52,7 @@ paskha(int R) /*year*/ d = (19*a + x) % 30; e = (2*b + 4*c + 6*d + y) % 7; cumdays = 31 + 28; - if (isleap(R)) + if (__isleap(R)) cumdays++; return ((cumdays + 22) + (d + e) + 13); } diff -up calendar-1.25/pesach.c.orig calendar-1.25/pesach.c --- calendar-1.25/pesach.c.orig 2004-12-10 10:50:45.000000000 -1000 +++ calendar-1.25/pesach.c 2009-02-12 15:32:37.000000000 -1000 @@ -22,7 +22,7 @@ static const char rcsid[] = "$OpenBSD: p #endif /* not lint */ #include -#include +#include #include "calendar.h" @@ -66,5 +66,5 @@ pesach(int R) if (R > 1582) cumdays += R / 100 - R /400 - 2; - return (31 + 28 + cumdays + (isleap(R)? 1 : 0)); + return (31 + 28 + cumdays + (__isleap(R)? 1 : 0)); }