From 74ef69c68a4f638d00741a4d379dbd1628ad6e41 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 14 Feb 1998 21:07:22 +0000 Subject: 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). --- usr.bin/calendar/io.c | 11 +++++++---- 1 file 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); -- cgit v1.2.3