summaryrefslogtreecommitdiffstats
path: root/usr.bin/rwho/rwho.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-03-21 20:26:51 +0000
committerache <ache@FreeBSD.org>2001-03-21 20:26:51 +0000
commit4b8b41b15455c7449b53e0a25c16c8dd918a1228 (patch)
tree3c1eff47f34de71843b07969f79470a43858ea1e /usr.bin/rwho/rwho.c
parent5d5fc406d7ed3e2ee9afa1bb9d4a25100a3edd5d (diff)
downloadFreeBSD-src-4b8b41b15455c7449b53e0a25c16c8dd918a1228.zip
FreeBSD-src-4b8b41b15455c7449b53e0a25c16c8dd918a1228.tar.gz
Don't attempt to parse %c
Diffstat (limited to 'usr.bin/rwho/rwho.c')
-rw-r--r--usr.bin/rwho/rwho.c12
1 files changed, 9 insertions, 3 deletions
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 <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) {
OpenPOWER on IntegriCloud