summaryrefslogtreecommitdiff
path: root/usr.bin/top/top.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-02-04 19:23:28 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-02-04 19:23:28 +0000
commitfb0ccdc90c47236c02e38ff249db297e3000945b (patch)
tree1e3e9b6421b187620b2eadc371b73bf3828be5e6 /usr.bin/top/top.c
parentd86323c9a2ac58f90473bfa7c1143c1bd18df832 (diff)
Complain of the user specifies a negative number for the 's' command.
From Mark Lumsden.
Diffstat (limited to 'usr.bin/top/top.c')
-rw-r--r--usr.bin/top/top.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c
index c079ea772f5..8f7ede47972 100644
--- a/usr.bin/top/top.c
+++ b/usr.bin/top/top.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: top.c,v 1.47 2007/02/04 19:17:14 otto Exp $ */
+/* $OpenBSD: top.c,v 1.48 2007/02/04 19:23:27 otto Exp $ */
/*
* Top users/processes display for Unix
@@ -731,10 +731,18 @@ rundisplay(void)
double newdelay = strtod(tempbuf2, &endp);
if (newdelay >= 0 && newdelay < 1000000 &&
- *endp == '\0')
+ *endp == '\0') {
delay = newdelay;
- }
- clear_message();
+ } else {
+ new_message(MT_standout,
+ "Delay should be a non-negative number");
+ if (putchar('\r') == EOF)
+ exit(1);
+ no_command = Yes;
+ }
+
+ } else
+ clear_message();
break;
case CMD_displays: /* change display count */