aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/posix/ps.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index 2e5338ea..279a947a 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -1448,11 +1448,12 @@ static void top_common(
} plist[2], *plold, *plnew, old, new, mix;
char scratch[16], *pos, *cpufields[] = {"user", "nice", "sys", "idle",
"iow", "irq", "sirq", "host"};
-
unsigned tock = 0;
int i, lines, topoff = 0, done = 0;
char stdout_buf[BUFSIZ];
+ if (!TT.fields) perror_exit("no -o");
+
// Avoid flicker and hide the cursor in interactive mode.
if (!FLAG(b)) {
setbuf(stdout, stdout_buf);