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