diff options
author | ache <ache@FreeBSD.org> | 2001-03-21 15:39:17 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-03-21 15:39:17 +0000 |
commit | a2371a0b8c39a7e176daff1690eb14c0babc16df (patch) | |
tree | f33d9550dfaa1187ffda29bda5870e7d1d2b4331 /usr.bin/calendar | |
parent | ab6110835d179ddb8fec93ccf90ec454bd5de20d (diff) | |
download | FreeBSD-src-a2371a0b8c39a7e176daff1690eb14c0babc16df.zip FreeBSD-src-a2371a0b8c39a7e176daff1690eb14c0babc16df.tar.gz |
Restore old locale properly
Diffstat (limited to 'usr.bin/calendar')
-rw-r--r-- | usr.bin/calendar/day.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/calendar/day.c b/usr.bin/calendar/day.c index cf619b6..490a2bd 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(); } |