diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2007-02-23 13:31:46 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2007-02-23 13:31:46 +0000 |
commit | ae518d31b3f513d5b05eccb1b834c06d89d61313 (patch) | |
tree | 5a1e0d28143fe19b4dd6e0723e48072186eb3147 /usr.bin/top/commands.c | |
parent | 68e92608e20dddc76c2cdd9279749cd046126724 (diff) |
Use sys_signame[] from libc instead of creating a top-specific
signame name to number table. Also use strcasecmp() when matching
signal names for consistency with /bin/kill.
OK deraadt@ henning@ simon@
Diffstat (limited to 'usr.bin/top/commands.c')
-rw-r--r-- | usr.bin/top/commands.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/usr.bin/top/commands.c b/usr.bin/top/commands.c index e2002229adc..c246d86e681 100644 --- a/usr.bin/top/commands.c +++ b/usr.bin/top/commands.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commands.c,v 1.26 2007/02/14 08:29:28 jmc Exp $ */ +/* $OpenBSD: commands.c,v 1.27 2007/02/23 13:31:45 millert Exp $ */ /* * Top users/processes display for Unix @@ -48,7 +48,6 @@ #include "top.h" -#include "sigdesc.h" /* generated automatically */ #include "boolean.h" #include "utils.h" #include "machine.h" @@ -314,7 +313,6 @@ char * kill_procs(char *str) { int signum = SIGTERM, procnum; - struct sigdesc *sigp; uid_t uid, puid; char *nptr; @@ -339,15 +337,13 @@ kill_procs(char *str) return (" invalid signal number"); } else { /* translate the name into a number */ - for (sigp = sigdesc; sigp->name != NULL; sigp++) { - if (strcmp(sigp->name, str + 1) == 0) { - signum = sigp->number; + for (signum = 0; signum < NSIG; signum++) { + if (strcasecmp(sys_signame[signum], str + 1) == 0) break; - } } /* was it ever found */ - if (sigp->name == NULL) + if (signum == NSIG) return (" bad signal name"); } /* put the new pointer in place */ |