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/calendar/io.c | |
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/calendar/io.c')
-rw-r--r-- | usr.bin/calendar/io.c | 20 |
1 files changed, 17 insertions, 3 deletions
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); |