diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-12-22 17:47:04 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-12-22 17:47:04 +0000 |
commit | 72a5dfdff27eff243becb3a647a0510b3228d41d (patch) | |
tree | 3da8d38cc7cd67330aff7e637714640b0ca0ed6a /bin/ksh/trap.c | |
parent | 4aaf844f3e1c78eb500a0a293ad086be182af979 (diff) |
Use sys_signame and sys_siglist instead of building a list of signal
values and names via an awk script. OK otto@
Diffstat (limited to 'bin/ksh/trap.c')
-rw-r--r-- | bin/ksh/trap.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/bin/ksh/trap.c b/bin/ksh/trap.c index 57ecc3227c7..e01ceb475d0 100644 --- a/bin/ksh/trap.c +++ b/bin/ksh/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.18 2004/12/22 17:14:34 millert Exp $ */ +/* $OpenBSD: trap.c,v 1.19 2004/12/22 17:47:03 millert Exp $ */ /* * signal handling @@ -6,16 +6,7 @@ #include "sh.h" -/* Table is indexed by signal number - * - * The script siglist.sh generates siglist.out, which is a sorted, complete - * list of signals - */ -Trap sigtraps[NSIG+1] = { - { SIGEXIT_, "EXIT", "Signal 0" }, -#include "siglist.out" /* generated by siglist.sh */ - { SIGERR_, "ERR", "Error handler" }, - }; +Trap sigtraps[NSIG + 1]; static struct sigaction Sigact_ign, Sigact_trap; @@ -24,10 +15,18 @@ inittraps() { int i; - /* Use system description, if available, for unknown signals... */ - for (i = 0; i < NSIG; i++) - if (!sigtraps[i].name && sys_siglist[i] && sys_siglist[i][0]) + /* Populate sigtraps based on sys_signame and sys_siglist. */ + for (i = 0; i <= NSIG; i++) { + sigtraps[i].signal = i; + if (i == SIGERR_) { + sigtraps[i].name = "ERR"; + sigtraps[i].mess = "Error handler"; + } else { + sigtraps[i].name = sys_signame[i]; sigtraps[i].mess = sys_siglist[i]; + } + } + sigtraps[SIGEXIT_].name = "EXIT"; /* our name for signal 0 */ sigemptyset(&Sigact_ign.sa_mask); Sigact_ign.sa_flags = 0; /* interruptible */ |