diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-03-21 19:16:41 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-03-21 19:16:41 +0000 |
commit | e36de81ee239af1d4569b5290cdec10850169953 (patch) | |
tree | 3d3bda9fa90b85694afdbbe210cb34825731d658 /usr.bin/who | |
parent | a99768c6e2ec85a9caab5cb622743c99dc159dd6 (diff) |
Don't attempt to parse %c
Notes
Notes:
svn path=/head/; revision=74589
Diffstat (limited to 'usr.bin/who')
-rw-r--r-- | usr.bin/who/who.c | 12 |
1 files 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 <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'); |