commit 921631a3a965ad1cdd44796100494770e538f402
parent efe687ef9443b540ebc11b1681badf1bfc7b42c6
Author: sin <sin@2f30.org>
Date: Wed, 25 Sep 2013 12:10:46 +0100
If ws_col is zero just dump the entire buffer
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/ps.c b/ps.c
@@ -127,7 +127,10 @@ psout(struct procstat *ps)
snprintf(buf, sizeof(buf), "%5d %-6s %02u:%02u:%02u %s", ps->pid, ttystr,
sutime / 3600, (sutime % 3600) / 60, sutime % 60,
ps->comm);
- printf("%.*s\n", w.ws_col, buf);
+ if (w.ws_col)
+ printf("%.*s\n", w.ws_col, buf);
+ else
+ printf("%s\n", buf);
} else {
errno = 0;
pw = getpwuid(pstatus.uid);
@@ -155,7 +158,10 @@ psout(struct procstat *ps)
sutime / 3600, (sutime % 3600) / 60, sutime % 60,
(cmd == ps->comm) ? "[" : "", cmd,
(cmd == ps->comm) ? "]" : "");
- printf("%.*s\n", w.ws_col, buf);
+ if (w.ws_col)
+ printf("%.*s\n", w.ws_col, buf);
+ else
+ printf("%s\n", buf);
}
free(ttystr);
}