diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-02-14 21:07:22 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-02-14 21:07:22 +0000 |
commit | 74ef69c68a4f638d00741a4d379dbd1628ad6e41 (patch) | |
tree | 132e7a4d66ecdcf69a401cecadcae9b2bfc113eb | |
parent | 7ad5b6e09d3458d05add8b84b4198b13af7939f8 (diff) |
Give correct format to strftime(3) instead of using "%c" and making
assumptions as to what that will look like (which is idiotic as %c
is locale-dependent).
-rw-r--r-- | usr.bin/calendar/io.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c index 3169ab3cf2b..3bc6d52b773 100644 --- a/usr.bin/calendar/io.c +++ b/usr.bin/calendar/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.2 1997/09/12 04:12:48 millert Exp $ */ +/* $OpenBSD: io.c,v 1.3 1998/02/14 21:07:21 millert Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -43,7 +43,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; #else -static char rcsid[] = "$OpenBSD: io.c,v 1.2 1997/09/12 04:12:48 millert Exp $"; +static char rcsid[] = "$OpenBSD: io.c,v 1.3 1998/02/14 21:07:21 millert Exp $"; #endif #endif /* not lint */ @@ -149,8 +149,11 @@ cal() 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'; + tm.tm_isdst = tp->tm_isdst; /* unused */ + tm.tm_gmtoff = tp->tm_gmtoff; /* unused */ + tm.tm_zone = tp->tm_zone; /* unused */ + (void)strftime(dbuf, sizeof(dbuf), "%a %b %d", + &tm); (void)fprintf(fp, "%s%c%s\n", dbuf + 4/* skip weekdays */, var ? '*' : ' ', p); |