Blob Blame Raw
diff -up calendar-1.28-20140613cvs/calendar.c.linux calendar-1.28-20140613cvs/calendar.c
--- calendar-1.28-20140613cvs/calendar.c.linux	2012-01-31 03:29:25.000000000 -0500
+++ calendar-1.28-20140613cvs/calendar.c	2014-06-13 11:55:10.282747232 -0400
@@ -35,14 +35,12 @@
 #include <err.h>
 #include <errno.h>
 #include <locale.h>
-#include <login_cap.h>
 #include <pwd.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include <tzfile.h>
 #include <unistd.h>
 
 #include "pathnames.h"
@@ -171,10 +169,6 @@ main(int argc, char *argv[])
 			case 0:	/* child */
 				(void)setpgid(getpid(), getpid());
 				(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.28-20140613cvs/calendar.h.linux calendar-1.28-20140613cvs/calendar.h
--- calendar-1.28-20140613cvs/calendar.h.linux	2010-04-28 14:20:15.000000000 -0400
+++ calendar-1.28-20140613cvs/calendar.h	2014-06-13 12:57:23.200747232 -0400
@@ -29,6 +29,7 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/types.h>
 
 extern struct passwd *pw;
 extern int doall;
@@ -110,7 +111,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];
@@ -120,3 +121,5 @@ extern struct specialev spev[NUMEV];
  * (e.g. by using named pipes)
  */
 #define USERTIMEOUT 20
+
+#define SECSPERDAY 86400
diff -up calendar-1.28-20140613cvs/day.c.linux calendar-1.28-20140613cvs/day.c
--- calendar-1.28-20140613cvs/day.c.linux	2013-11-26 08:18:53.000000000 -0500
+++ calendar-1.28-20140613cvs/day.c	2014-06-13 11:55:10.283747232 -0400
@@ -39,7 +39,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include <tzfile.h>
 
 #include "pathnames.h"
 #include "calendar.h"
@@ -157,7 +156,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];
@@ -288,8 +287,10 @@ isnow(char *endp, int bodun)
 		return (NULL);
 
 	/* adjust bodun rate */
-	if (bodun && !bodun_always)
-		bodun = !arc4random_uniform(3);
+	if (bodun && !bodun_always) {
+		srandom(3);
+		bodun = random();
+	}
 		
 	/* Easter or Easter depending days */
 	if (flags & F_SPECIAL)
@@ -440,7 +441,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)
@@ -676,7 +677,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.28-20140613cvs/io.c.linux calendar-1.28-20140613cvs/io.c
--- calendar-1.28-20140613cvs/io.c.linux	2013-11-26 08:18:53.000000000 -0500
+++ calendar-1.28-20140613cvs/io.c	2014-06-13 11:55:10.283747232 -0400
@@ -45,7 +45,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <tzfile.h>
 #include <unistd.h>
 
 #include "pathnames.h"
@@ -68,7 +67,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.28-20140613cvs/ostern.c.linux calendar-1.28-20140613cvs/ostern.c
--- calendar-1.28-20140613cvs/ostern.c.linux	2009-10-27 19:59:36.000000000 -0400
+++ calendar-1.28-20140613cvs/ostern.c	2014-06-13 11:55:10.283747232 -0400
@@ -30,7 +30,6 @@
 
 #include <stdio.h>
 #include <time.h>
-#include <tzfile.h>
 
 #include "calendar.h"
 
@@ -61,7 +60,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.28-20140613cvs/paskha.c.linux calendar-1.28-20140613cvs/paskha.c
--- calendar-1.28-20140613cvs/paskha.c.linux	2009-10-27 19:59:36.000000000 -0400
+++ calendar-1.28-20140613cvs/paskha.c	2014-06-13 13:44:02.029747232 -0400
@@ -27,7 +27,7 @@
  */
 
 #include <stdio.h>
-#include <tzfile.h>
+#include <time.h>
 
 #include "calendar.h"
 
@@ -48,7 +48,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.28-20140613cvs/pesach.c.linux calendar-1.28-20140613cvs/pesach.c
--- calendar-1.28-20140613cvs/pesach.c.linux	2009-10-27 19:59:36.000000000 -0400
+++ calendar-1.28-20140613cvs/pesach.c	2014-06-13 12:57:51.624747232 -0400
@@ -18,7 +18,7 @@
  */
 
 #include <stdio.h>
-#include <tzfile.h>
+#include <time.h>
 
 #include "calendar.h"
 
@@ -62,5 +62,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));
 }