1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2026-01-03 20:51:07 +01:00

fix autoloaded trap bug; rejig use of trapfuncs

(now traplists); improve trap tests
This commit is contained in:
Peter Stephenson 2005-02-06 20:36:09 +00:00
parent 64c2db0ca2
commit 05b06b1c08
9 changed files with 129 additions and 41 deletions

View file

@ -2617,14 +2617,12 @@ bin_functions(char *name, char **argv, Options ops, int func)
shfunctab->addnode(shfunctab, ztrdup(*argv), shf);
if (signum != -1) {
if (settrap(signum, shf->funcdef)) {
if (settrap(signum, NULL, ZSIG_FUNC)) {
shfunctab->removenode(shfunctab, *argv);
shfunctab->freenode((HashNode)shf);
returnval = 1;
ok = 0;
}
else
sigtrapped[signum] |= ZSIG_FUNC;
}
if (ok && OPT_ISSET(ops,'X') &&
@ -4967,10 +4965,10 @@ bin_trap(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
shfunctab->printnode(hn, 0);
DPUTS(!hn, "BUG: I did not find any trap functions!");
} else if (sigtrapped[sig]) {
if (!sigfuncs[sig])
if (!siglists[sig])
printf("trap -- '' %s\n", sigs[sig]);
else {
s = getpermtext(sigfuncs[sig], NULL);
s = getpermtext(siglists[sig], NULL);
printf("trap -- ");
quotedzputs(s, stdout);
printf(" %s\n", sigs[sig]);
@ -5013,7 +5011,7 @@ bin_trap(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
break;
}
t = dupeprog(prog, 0);
if (settrap(sig, t))
if (settrap(sig, t, 0))
freeeprog(t);
}
return *argv != NULL;