Don't attempt to parse %c

This commit is contained in:
Andrey A. Chernov 2001-03-21 19:16:41 +00:00
parent a99768c6e2
commit e36de81ee2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74589

View File

@ -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');