If ws_col is zero just dump the entire buffer
This commit is contained in:
parent
efe687ef94
commit
921631a3a9
6
ps.c
6
ps.c
@ -127,7 +127,10 @@ psout(struct procstat *ps)
|
|||||||
snprintf(buf, sizeof(buf), "%5d %-6s %02u:%02u:%02u %s", ps->pid, ttystr,
|
snprintf(buf, sizeof(buf), "%5d %-6s %02u:%02u:%02u %s", ps->pid, ttystr,
|
||||||
sutime / 3600, (sutime % 3600) / 60, sutime % 60,
|
sutime / 3600, (sutime % 3600) / 60, sutime % 60,
|
||||||
ps->comm);
|
ps->comm);
|
||||||
|
if (w.ws_col)
|
||||||
printf("%.*s\n", w.ws_col, buf);
|
printf("%.*s\n", w.ws_col, buf);
|
||||||
|
else
|
||||||
|
printf("%s\n", buf);
|
||||||
} else {
|
} else {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
pw = getpwuid(pstatus.uid);
|
pw = getpwuid(pstatus.uid);
|
||||||
@ -155,7 +158,10 @@ psout(struct procstat *ps)
|
|||||||
sutime / 3600, (sutime % 3600) / 60, sutime % 60,
|
sutime / 3600, (sutime % 3600) / 60, sutime % 60,
|
||||||
(cmd == ps->comm) ? "[" : "", cmd,
|
(cmd == ps->comm) ? "[" : "", cmd,
|
||||||
(cmd == ps->comm) ? "]" : "");
|
(cmd == ps->comm) ? "]" : "");
|
||||||
|
if (w.ws_col)
|
||||||
printf("%.*s\n", w.ws_col, buf);
|
printf("%.*s\n", w.ws_col, buf);
|
||||||
|
else
|
||||||
|
printf("%s\n", buf);
|
||||||
}
|
}
|
||||||
free(ttystr);
|
free(ttystr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user