diff -up calendar-1.25-20091114cvs/calendar.c.linux calendar-1.25-20091114cvs/calendar.c
--- calendar-1.25-20091114cvs/calendar.c.linux 2009-11-14 11:14:59.000000000 -1000
+++ calendar-1.25-20091114cvs/calendar.c 2010-02-24 06:13:22.000000000 -1000
@@ -49,14 +49,12 @@ static const char rcsid[] = "$OpenBSD: c
#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"
@@ -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-20091114cvs/calendar.h.linux calendar-1.25-20091114cvs/calendar.h
--- calendar-1.25-20091114cvs/calendar.h.linux 2009-11-14 11:14:59.000000000 -1000
+++ calendar-1.25-20091114cvs/calendar.h 2010-02-24 06:13:22.000000000 -1000
@@ -29,6 +29,7 @@
* SUCH DAMAGE.
*/
+#include <sys/uio.h>
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-20091114cvs/day.c.linux calendar-1.25-20091114cvs/day.c
--- calendar-1.25-20091114cvs/day.c.linux 2009-11-14 11:14:59.000000000 -1000
+++ calendar-1.25-20091114cvs/day.c 2010-02-24 06:13:40.000000000 -1000
@@ -53,7 +53,6 @@ static const char rcsid[] = "$OpenBSD: d
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <tzfile.h>
#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];
@@ -300,8 +299,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)
@@ -452,7 +453,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 +689,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-20091114cvs/io.c.linux calendar-1.25-20091114cvs/io.c
--- calendar-1.25-20091114cvs/io.c.linux 2009-11-14 11:14:59.000000000 -1000
+++ calendar-1.25-20091114cvs/io.c 2010-02-24 06:13:22.000000000 -1000
@@ -59,7 +59,6 @@ static const char rcsid[] = "$OpenBSD: i
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <tzfile.h>
#include <unistd.h>
#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-20091114cvs/ostern.c.linux calendar-1.25-20091114cvs/ostern.c
--- calendar-1.25-20091114cvs/ostern.c.linux 2009-11-14 11:14:59.000000000 -1000
+++ calendar-1.25-20091114cvs/ostern.c 2010-02-24 06:13:22.000000000 -1000
@@ -34,7 +34,6 @@ static const char rcsid[] = "$OpenBSD: o
#include <stdio.h>
#include <time.h>
-#include <tzfile.h>
#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-20091114cvs/paskha.c.linux calendar-1.25-20091114cvs/paskha.c
--- calendar-1.25-20091114cvs/paskha.c.linux 2009-11-14 11:14:59.000000000 -1000
+++ calendar-1.25-20091114cvs/paskha.c 2010-02-24 06:13:22.000000000 -1000
@@ -31,7 +31,7 @@ static const char rcsid[] = "$OpenBSD: p
#endif /* not lint */
#include <stdio.h>
-#include <tzfile.h>
+#include <time.h>
#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-20091114cvs/pesach.c.linux calendar-1.25-20091114cvs/pesach.c
--- calendar-1.25-20091114cvs/pesach.c.linux 2009-11-14 11:14:59.000000000 -1000
+++ calendar-1.25-20091114cvs/pesach.c 2010-02-24 06:13:22.000000000 -1000
@@ -22,7 +22,7 @@ static const char rcsid[] = "$OpenBSD: p
#endif /* not lint */
#include <stdio.h>
-#include <tzfile.h>
+#include <time.h>
#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));
}