From e36de81ee239af1d4569b5290cdec10850169953 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Wed, 21 Mar 2001 19:16:41 +0000 Subject: [PATCH] Don't attempt to parse %c --- usr.bin/who/who.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c index 76ecdc2ae94d..c4a53ee686d8 100644 --- a/usr.bin/who/who.c +++ b/usr.bin/who/who.c @@ -51,6 +51,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -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');