Reduce the command field width by one when idle time is > 9 days, to
eliminate unsightly blank line. Possibly a 2.2 candidate.
This commit is contained in:
parent
db03b748e3
commit
70498d5a53
@ -35,5 +35,5 @@
|
||||
|
||||
struct proc;
|
||||
void pr_attime __P((time_t *, time_t *));
|
||||
void pr_idle __P((time_t));
|
||||
int pr_idle __P((time_t));
|
||||
int proc_compare __P((struct proc *, struct proc *));
|
||||
|
@ -84,7 +84,7 @@ pr_attime(started, now)
|
||||
* pr_idle --
|
||||
* Display the idle time.
|
||||
*/
|
||||
void
|
||||
int
|
||||
pr_idle(idle)
|
||||
time_t idle;
|
||||
{
|
||||
@ -92,6 +92,8 @@ pr_idle(idle)
|
||||
if (idle >= 36 * 3600) {
|
||||
int days = idle / 86400;
|
||||
(void)printf(" %dday%s ", days, days > 1 ? "s" : " " );
|
||||
if (days >= 10)
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* If idle more than an hour, print as HH:MM. */
|
||||
@ -105,4 +107,6 @@ pr_idle(idle)
|
||||
/* Else print the minutes idle. */
|
||||
else
|
||||
(void)printf(" %2d ", idle / 60);
|
||||
|
||||
return(0); /* not idle longer than 9 days */
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ main(argc, argv)
|
||||
FILE *ut;
|
||||
u_long l;
|
||||
size_t arglen;
|
||||
int ch, i, nentries, nusers, wcmd;
|
||||
int ch, i, nentries, nusers, wcmd, longidle;
|
||||
char *memf, *nlistf, *p, *vis_args, *x;
|
||||
char buf[MAXHOSTNAMELEN], errbuf[256];
|
||||
|
||||
@ -345,7 +345,9 @@ main(argc, argv)
|
||||
ep->utmp.ut_line : ep->utmp.ut_line + 3,
|
||||
UT_HOSTSIZE, UT_HOSTSIZE, *p ? p : "-");
|
||||
pr_attime(&ep->utmp.ut_time, &now);
|
||||
pr_idle(ep->idle);
|
||||
longidle=pr_idle(ep->idle);
|
||||
if (longidle)
|
||||
argwidth--;
|
||||
if (ep->args != NULL) {
|
||||
arglen = strlen(ep->args);
|
||||
strvisx(vis_args, ep->args,
|
||||
|
Loading…
Reference in New Issue
Block a user