summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-03-21 19:16:41 +0000
committerache <ache@FreeBSD.org>2001-03-21 19:16:41 +0000
commitb84641bbc8fac49cbc8ec1c61847d6a568067ec7 (patch)
treeb9c8df7d05f147b5df0f685e6fb0dafdd039e387
parentf46163dd362f394f76d33e1186489ee7970fac38 (diff)
downloadFreeBSD-src-b84641bbc8fac49cbc8ec1c61847d6a568067ec7.zip
FreeBSD-src-b84641bbc8fac49cbc8ec1c61847d6a568067ec7.tar.gz
Don't attempt to parse %c
-rw-r--r--usr.bin/who/who.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c
index 76ecdc2..c4a53ee 100644
--- a/usr.bin/who/who.c
+++ b/usr.bin/who/who.c
@@ -51,6 +51,7 @@ static const char rcsid[] =
#include <sys/types.h>
#include <sys/file.h>
#include <err.h>
+#include <langinfo.h>
#include <locale.h>
#include <pwd.h>
#include <stdio.h>
@@ -136,12 +137,17 @@ output(up)
struct utmp *up;
{
char buf[80];
+ static int d_first = -1;
+
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
(void)printf("%-*.*s %-*.*s", UT_NAMESIZE, UT_NAMESIZE, up->ut_name,
UT_LINESIZE, UT_LINESIZE, up->ut_line);
- (void)strftime(buf, sizeof(buf), "%c", localtime(&up->ut_time));
- buf[sizeof(buf) - 1] = '\0';
- (void)printf("%.12s", buf + 4);
+ (void)strftime(buf, sizeof(buf),
+ d_first ? "%e %b %R" : "%b %e %R",
+ localtime(&up->ut_time));
+ (void)printf("%s", buf);
if (*up->ut_host)
printf("\t(%.*s)", UT_HOSTSIZE, up->ut_host);
(void)putchar('\n');
OpenPOWER on IntegriCloud