This commit is contained in:
tg 2007-01-12 01:30:35 +00:00
parent 6fb4af0a9d
commit c430db0b00

View File

@ -3,7 +3,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.36 2007/01/12 00:37:09 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.37 2007/01/12 01:30:35 tg Exp $");
Trap sigtraps[NSIG + 1]; Trap sigtraps[NSIG + 1];
static struct sigaction Sigact_ign, Sigact_trap; static struct sigaction Sigact_ign, Sigact_trap;
@ -961,7 +961,7 @@ void
inittraps(void) inittraps(void)
{ {
int i; int i;
char *s; const char *cs;
/* Populate sigtraps based on sys_signame and sys_siglist. */ /* Populate sigtraps based on sys_signame and sys_siglist. */
for (i = 0; i <= NSIG; i++) { for (i = 0; i <= NSIG; i++) {
@ -971,19 +971,21 @@ inittraps(void)
sigtraps[i].mess = "Error handler"; sigtraps[i].mess = "Error handler";
} else { } else {
#if HAVE_SYS_SIGNAME || HAVE_SYS_SIGNAME #if HAVE_SYS_SIGNAME || HAVE_SYS_SIGNAME
s = sys_signame[i]; cs = sys_signame[i];
#else #else
const struct mksh_sigpair *pair = mksh_sigpairs; const struct mksh_sigpair *pair = mksh_sigpairs;
while ((pair->nr != i) && (pair->name != NULL)) while ((pair->nr != i) && (pair->name != NULL))
++pair; ++pair;
s = pair->name; cs = pair->name;
#endif #endif
if ((s == NULL) || if ((cs == NULL) ||
(s[0] == '\0')) (cs[0] == '\0'))
sigtraps[i].name = shf_smprintf("%d", i); sigtraps[i].name = shf_smprintf("%d", i);
else { else {
char *s;
sigtraps[i].name = s = str_save( sigtraps[i].name = s = str_save(
!strncasecmp(s, "SIG", 3) ? s + 3 : s, !strncasecmp(cs, "SIG", 3) ? cs + 3 : cs,
APERM); APERM);
while (*s = ksh_toupper(*s)) while (*s = ksh_toupper(*s))
++s; ++s;