From ae518d31b3f513d5b05eccb1b834c06d89d61313 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 23 Feb 2007 13:31:46 +0000 Subject: 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@ --- usr.bin/top/commands.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'usr.bin/top/commands.c') 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 */ -- cgit v1.2.3