diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-03-21 20:26:51 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-03-21 20:26:51 +0000 |
commit | 3bd65123fa6d6913762f91bd4d9e27ac4eec22e6 (patch) | |
tree | 464f2c9837dbff5a90cb1582533868060984fe5c /usr.bin/rwho | |
parent | b833d157c718be96d1496336733f8c285fb04b49 (diff) | |
download | src-test2-3bd65123fa6d6913762f91bd4d9e27ac4eec22e6.tar.gz src-test2-3bd65123fa6d6913762f91bd4d9e27ac4eec22e6.zip |
Notes
Diffstat (limited to 'usr.bin/rwho')
-rw-r--r-- | usr.bin/rwho/rwho.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/rwho/rwho.c b/usr.bin/rwho/rwho.c index c9045f1f9e2f..b2c23632d7e5 100644 --- a/usr.bin/rwho/rwho.c +++ b/usr.bin/rwho/rwho.c @@ -50,6 +50,7 @@ static const char rcsid[] = #include <protocols/rwhod.h> #include <dirent.h> #include <err.h> +#include <langinfo.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> @@ -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) { |