diff options
author | ache <ache@FreeBSD.org> | 1996-05-10 19:31:02 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1996-05-10 19:31:02 +0000 |
commit | 9fe3b1633ad7c0a4710f3e92c67f36011748d98c (patch) | |
tree | abe9257e02c1969caec23509a68972ff6d675699 /usr.bin | |
parent | a28a8481af3f2a2145d2a6c164a6299934c2bb3f (diff) | |
download | FreeBSD-src-9fe3b1633ad7c0a4710f3e92c67f36011748d98c.zip FreeBSD-src-9fe3b1633ad7c0a4710f3e92c67f36011748d98c.tar.gz |
Localize even more.
FIx Orthodox Easter calculation
Better debug output
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/calendar/day.c | 15 | ||||
-rw-r--r-- | usr.bin/calendar/io.c | 20 | ||||
-rw-r--r-- | usr.bin/calendar/paskha.c | 2 |
3 files changed, 22 insertions, 15 deletions
diff --git a/usr.bin/calendar/day.c b/usr.bin/calendar/day.c index 0a5ff8f..210e8d3 100644 --- a/usr.bin/calendar/day.c +++ b/usr.bin/calendar/day.c @@ -101,10 +101,6 @@ void setnnames(void) free(fndays[i].name); fndays[i].name = strdup(buf); fndays[i].len = strlen(buf); -#ifdef DEBUG - printf("ndays[%d] = %s, fndays[%d] = %s\n", - i, ndays[i].name, i, fndays[i].name); -#endif } for (i = 0; i < 12; i++) { @@ -130,10 +126,6 @@ void setnnames(void) free(fnmonths[i].name); fnmonths[i].name = strdup(buf); fnmonths[i].len = strlen(buf); -#ifdef DEBUG - printf("nmonths[%d] = %s, fnmonths[%d] = %s\n", - i, nmonths[i].name, i, fnmonths[i].name); -#endif } } @@ -177,6 +169,7 @@ time_t Mktime (date) tm.tm_sec = 0; tm.tm_min = 0; tm.tm_hour = 0; + tm.tm_wday = 0; tm.tm_mday = tp->tm_mday; tm.tm_mon = tp->tm_mon; tm.tm_year = tp->tm_year; @@ -356,9 +349,6 @@ isnow(endp, monthp, dayp, varp) } } -#if DEBUG - fprintf(stderr, "day2: day %d yday %d\n", day, tp->tm_yday); -#endif if (!(flags & F_EASTER)) { *monthp = month; *dayp = day; @@ -372,6 +362,9 @@ isnow(endp, monthp, dayp, varp) *varp = 1; } +#if DEBUG + fprintf(stderr, "day2: day %d(%d) yday %d\n", *dayp, day, tp->tm_yday); +#endif /* if today or today + offset days */ if (day >= tp->tm_yday - f_dayBefore && day <= tp->tm_yday + offset + f_dayAfter) diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c index 8b2a676..fbc5d46 100644 --- a/usr.bin/calendar/io.c +++ b/usr.bin/calendar/io.c @@ -129,9 +129,23 @@ cal() continue; if (p > buf && p[-1] == '*') var = 1; - if (printing) - (void)fprintf(fp, "%.2d/%.2d%c%s\n", month, - day, var ? '*' : ' ', p); + if (printing) { + struct tm tm; + char dbuf[30]; + + tm.tm_sec = 0; /* unused */ + tm.tm_min = 0; /* unused */ + tm.tm_hour = 0; /* unused */ + tm.tm_wday = 0; /* unused */ + tm.tm_mon = month - 1; + tm.tm_mday = day; + tm.tm_year = tp->tm_year; /* unused */ + (void)strftime(dbuf, sizeof(dbuf), "%c", &tm); + dbuf[10] = '\0'; + (void)fprintf(fp, "%s%c%s\n", + dbuf + 4/* skip weekdays */, + var ? '*' : ' ', p); + } } else if (printing) fprintf(fp, "%s\n", buf); diff --git a/usr.bin/calendar/paskha.c b/usr.bin/calendar/paskha.c index 28eb8c0..42c2058 100644 --- a/usr.bin/calendar/paskha.c +++ b/usr.bin/calendar/paskha.c @@ -50,7 +50,7 @@ int R; /*year*/ c = R % 7; d = (19*a + x) % 30; e = (2*b + 4*c + 6*d + y) % 7; - return ((cumdays[2/*feb*/] + 22/*mar*/) + (d + e)); + return (((cumdays[3] + 1) + 22) + (d + e)); } /* return year day for Orthodox Easter depending days */ |