From 4b8b41b15455c7449b53e0a25c16c8dd918a1228 Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 21 Mar 2001 20:26:51 +0000 Subject: Don't attempt to parse %c --- usr.bin/rwho/rwho.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'usr.bin/rwho/rwho.c') diff --git a/usr.bin/rwho/rwho.c b/usr.bin/rwho/rwho.c index c9045f1..b2c2363 100644 --- a/usr.bin/rwho/rwho.c +++ b/usr.bin/rwho/rwho.c @@ -50,6 +50,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -94,8 +95,10 @@ main(argc, argv) register struct whoent *we; register struct myutmp *mp; int f, n, i; + int d_first; (void) setlocale(LC_TIME, ""); + d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); while ((ch = getopt(argc, argv, "a")) != -1) switch((char)ch) { @@ -159,15 +162,18 @@ main(argc, argv) mp = myutmp; for (i = 0; i < nusers; i++) { char buf[BUFSIZ], cbuf[80]; - strftime(cbuf, sizeof(cbuf), "%c", localtime((time_t *)&mp->myutmp.out_time)); + + strftime(cbuf, sizeof(cbuf), + d_first ? "%e %b %R" : "%b %e %R", + localtime((time_t *)&mp->myutmp.out_time)); (void)sprintf(buf, "%s:%-.*s", mp->myhost, sizeof(mp->myutmp.out_line), mp->myutmp.out_line); - printf("%-*.*s %-*s %.12s", + printf("%-*.*s %-*s %s", UT_NAMESIZE, sizeof(mp->myutmp.out_name), mp->myutmp.out_name, width, buf, - cbuf + 4); + cbuf); mp->myidle /= 60; if (mp->myidle) { if (aflg) { -- cgit v1.1