From 1f30a4236c7b4ee4ad75100269361a74b3feb154 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Wed, 21 Mar 2001 15:39:17 +0000 Subject: [PATCH] Restore old locale properly --- usr.bin/calendar/day.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.bin/calendar/day.c b/usr.bin/calendar/day.c index cf619b607c22..490a2bdb798d 100644 --- a/usr.bin/calendar/day.c +++ b/usr.bin/calendar/day.c @@ -140,6 +140,8 @@ void settime(now) time_t now; { + char *oldl; + tp = localtime(&now); if ( isleap(tp->tm_year + 1900) ) { yrdays = 366; @@ -152,9 +154,10 @@ settime(now) offset = tp->tm_wday == 5 ? 3 : 1; header[5].iov_base = dayname; + oldl = setlocale(LC_TIME, NULL); (void) setlocale(LC_TIME, "C"); header[5].iov_len = strftime(dayname, sizeof(dayname), "%A", tp); - (void) setlocale(LC_TIME, ""); + (void) setlocale(LC_TIME, oldl); setnnames(); }