summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/top/top.c65
1 files changed, 32 insertions, 33 deletions
diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c
index c7ff8923f5b..47e36ce9341 100644
--- a/usr.bin/top/top.c
+++ b/usr.bin/top/top.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: top.c,v 1.55 2007/09/26 11:06:41 otto Exp $ */
+/* $OpenBSD: top.c,v 1.56 2007/09/27 19:44:54 otto Exp $ */
/*
* Top users/processes display for Unix
@@ -505,7 +505,7 @@ restart:
int
rundisplay(void)
{
- static char tempbuf1[50], tempbuf2[50];
+ static char tempbuf[50];
sigset_t mask;
char ch, *iptr;
int change, i;
@@ -656,7 +656,7 @@ rundisplay(void)
case CMD_number2:
new_message(MT_standout,
"Number of processes to show: ");
- newval = readline(tempbuf1, 8, Yes);
+ newval = readline(tempbuf, 8, Yes);
if (newval > -1) {
if (newval > max_topn) {
new_message(MT_standout | MT_delayed,
@@ -677,9 +677,9 @@ rundisplay(void)
case CMD_delay: /* new seconds delay */
new_message(MT_standout, "Seconds to delay: ");
- if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) {
+ if (readline(tempbuf, sizeof(tempbuf), No) > 0) {
char *endp;
- double newdelay = strtod(tempbuf2, &endp);
+ double newdelay = strtod(tempbuf, &endp);
if (newdelay >= 0 && newdelay < 1000000 &&
*endp == '\0') {
@@ -700,7 +700,7 @@ rundisplay(void)
"Displays to show (currently %s): ",
displays == -1 ? "infinite" :
itoa(displays));
- if ((i = readline(tempbuf1, 10, Yes)) > 0)
+ if ((i = readline(tempbuf, 10, Yes)) > 0)
displays = i;
else if (i == 0)
quit(0);
@@ -710,8 +710,8 @@ rundisplay(void)
case CMD_kill: /* kill program */
new_message(0, "kill ");
- if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) {
- if ((errmsg = kill_procs(tempbuf2)) != NULL) {
+ if (readline(tempbuf, sizeof(tempbuf), No) > 0) {
+ if ((errmsg = kill_procs(tempbuf)) != NULL) {
new_message(MT_standout, "%s", errmsg);
putr();
no_command = Yes;
@@ -722,8 +722,8 @@ rundisplay(void)
case CMD_renice: /* renice program */
new_message(0, "renice ");
- if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) {
- if ((errmsg = renice_procs(tempbuf2)) != NULL) {
+ if (readline(tempbuf, sizeof(tempbuf), No) > 0) {
+ if ((errmsg = renice_procs(tempbuf)) != NULL) {
new_message(MT_standout, "%s", errmsg);
putr();
no_command = Yes;
@@ -744,13 +744,13 @@ rundisplay(void)
case CMD_user:
new_message(MT_standout,
"Username to show: ");
- if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) {
- if (tempbuf2[0] == '+' &&
- tempbuf2[1] == '\0') {
+ if (readline(tempbuf, sizeof(tempbuf), No) > 0) {
+ if (tempbuf[0] == '+' &&
+ tempbuf[1] == '\0') {
ps.uid = (uid_t)-1;
- } else if ((uid = userid(tempbuf2)) == (uid_t)-1) {
+ } else if ((uid = userid(tempbuf)) == (uid_t)-1) {
new_message(MT_standout,
- " %s: unknown user", tempbuf2);
+ " %s: unknown user", tempbuf);
no_command = Yes;
} else
ps.uid = uid;
@@ -770,13 +770,12 @@ rundisplay(void)
case CMD_order:
new_message(MT_standout,
"Order to sort: ");
- if (readline(tempbuf2,
- sizeof(tempbuf2), No) > 0) {
- if ((i = string_index(tempbuf2,
+ if (readline(tempbuf, sizeof(tempbuf), No) > 0) {
+ if ((i = string_index(tempbuf,
statics.order_names)) == -1) {
new_message(MT_standout,
" %s: unrecognized sorting order",
- tempbuf2);
+ tempbuf);
no_command = Yes;
} else
order_index = i;
@@ -787,21 +786,21 @@ rundisplay(void)
case CMD_pid:
new_message(MT_standout, "Process ID to show: ");
- if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) {
- if (tempbuf2[0] == '+' &&
- tempbuf2[1] == '\0') {
+ if (readline(tempbuf, sizeof(tempbuf), No) > 0) {
+ if (tempbuf[0] == '+' &&
+ tempbuf[1] == '\0') {
ps.pid = (pid_t)-1;
ps.system = old_system;
} else {
unsigned long long num;
const char *errstr;
- num = strtonum(tempbuf2, 0, INT_MAX,
+ num = strtonum(tempbuf, 0, INT_MAX,
&errstr);
if (errstr != NULL || !find_pid(num)) {
new_message(MT_standout,
" %s: unknown pid",
- tempbuf2);
+ tempbuf);
no_command = Yes;
} else {
if (ps.system == No)
@@ -830,13 +829,13 @@ rundisplay(void)
case CMD_grep:
new_message(MT_standout,
"Grep command name: ");
- if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) {
+ if (readline(tempbuf, sizeof(tempbuf), No) > 0) {
free(ps.command);
- if (tempbuf2[0] == '+' &&
- tempbuf2[1] == '\0')
+ if (tempbuf[0] == '+' &&
+ tempbuf[1] == '\0')
ps.command = NULL;
else
- ps.command = strdup(tempbuf2);
+ ps.command = strdup(tempbuf);
putr();
} else
clear_message();
@@ -844,20 +843,20 @@ rundisplay(void)
case CMD_hl:
new_message(MT_standout, "Process ID to highlight: ");
- if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) {
- if (tempbuf2[0] == '+' &&
- tempbuf2[1] == '\0') {
+ if (readline(tempbuf, sizeof(tempbuf), No) > 0) {
+ if (tempbuf[0] == '+' &&
+ tempbuf[1] == '\0') {
hlpid = -1;
} else {
unsigned long long num;
const char *errstr;
- num = strtonum(tempbuf2, 0, INT_MAX,
+ num = strtonum(tempbuf, 0, INT_MAX,
&errstr);
if (errstr != NULL || !find_pid(num)) {
new_message(MT_standout,
" %s: unknown pid",
- tempbuf2);
+ tempbuf);
no_command = Yes;
} else
hlpid = (pid_t)num;