Don't attempt to parse %c

This commit is contained in:
Andrey A. Chernov 2001-03-21 20:26:51 +00:00
parent b833d157c7
commit 3bd65123fa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74593

View File

@ -50,6 +50,7 @@ static const char rcsid[] =
#include <protocols/rwhod.h> #include <protocols/rwhod.h>
#include <dirent.h> #include <dirent.h>
#include <err.h> #include <err.h>
#include <langinfo.h>
#include <locale.h> #include <locale.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -94,8 +95,10 @@ main(argc, argv)
register struct whoent *we; register struct whoent *we;
register struct myutmp *mp; register struct myutmp *mp;
int f, n, i; int f, n, i;
int d_first;
(void) setlocale(LC_TIME, ""); (void) setlocale(LC_TIME, "");
d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
while ((ch = getopt(argc, argv, "a")) != -1) while ((ch = getopt(argc, argv, "a")) != -1)
switch((char)ch) { switch((char)ch) {
@ -159,15 +162,18 @@ main(argc, argv)
mp = myutmp; mp = myutmp;
for (i = 0; i < nusers; i++) { for (i = 0; i < nusers; i++) {
char buf[BUFSIZ], cbuf[80]; 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, (void)sprintf(buf, "%s:%-.*s", mp->myhost,
sizeof(mp->myutmp.out_line), mp->myutmp.out_line); sizeof(mp->myutmp.out_line), mp->myutmp.out_line);
printf("%-*.*s %-*s %.12s", printf("%-*.*s %-*s %s",
UT_NAMESIZE, sizeof(mp->myutmp.out_name), UT_NAMESIZE, sizeof(mp->myutmp.out_name),
mp->myutmp.out_name, mp->myutmp.out_name,
width, width,
buf, buf,
cbuf + 4); cbuf);
mp->myidle /= 60; mp->myidle /= 60;
if (mp->myidle) { if (mp->myidle) {
if (aflg) { if (aflg) {