idle time == 0 printed now as "-" like in good old BSD

skip cua* 3 chars as tty* 3 lchars
This commit is contained in:
Andrey A. Chernov 1994-09-27 01:00:18 +00:00
parent 5517824990
commit 255318a894
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=3138
2 changed files with 5 additions and 1 deletions

View File

@ -98,6 +98,9 @@ pr_idle(idle)
(void)printf(" %2d:%02d ",
idle / SECSPERHOUR, (idle % SECSPERHOUR) / SECSPERMIN);
else if (idle / SECSPERMIN == 0)
(void)printf(" - ");
/* Else print the minutes idle. */
else
(void)printf(" %2d ", idle / SECSPERMIN);

View File

@ -312,7 +312,8 @@ main(argc, argv)
}
(void)printf("%-*.*s %-2.2s %-*.*s ",
UT_NAMESIZE, UT_NAMESIZE, ep->utmp.ut_name,
strncmp(ep->utmp.ut_line, "tty", 3) ?
strncmp(ep->utmp.ut_line, "tty", 3) &&
strncmp(ep->utmp.ut_line, "cua", 3) ?
ep->utmp.ut_line : ep->utmp.ut_line + 3,
UT_HOSTSIZE, UT_HOSTSIZE, *p ? p : "-");
pr_attime(&ep->utmp.ut_time, &now);