From 5fb95a2095446b02c21f0e4ecad4b7bff41c856a Mon Sep 17 00:00:00 2001 From: ume Date: Sun, 30 Aug 2009 11:17:42 +0000 Subject: Fix the problem that the entry broke into two lines with multi-byte AM/PM format. Reported by: takawata --- usr.bin/w/w.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr.bin/w/w.c') diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 379e6a4..10ec7b0 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -137,7 +137,7 @@ main(int argc, char *argv[]) struct stat *stp; FILE *ut; time_t touched; - int ch, i, nentries, nusers, wcmd, longidle, dropgid; + int ch, i, nentries, nusers, wcmd, longidle, longattime, dropgid; const char *memf, *nlistf, *p; char *x_suffix; char buf[MAXHOSTNAMELEN], errbuf[_POSIX2_LINE_MAX]; @@ -406,9 +406,10 @@ main(int argc, char *argv[]) ep->utmp.ut_line : ep->utmp.ut_line + 3, W_DISPHOSTSIZE, W_DISPHOSTSIZE, *p ? p : "-"); t = _time_to_time32(ep->utmp.ut_time); - pr_attime(&t, &now); + longattime = pr_attime(&t, &now); longidle = pr_idle(ep->idle); - (void)printf("%.*s\n", argwidth - longidle, ep->args); + (void)printf("%.*s\n", argwidth - longidle - longattime, + ep->args); } (void)kvm_close(kd); exit(0); -- cgit v1.1