1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-02-24 11:51:19 +01:00

20888: allow signal names to have the SIG prefix included

This commit is contained in:
Peter Stephenson 2005-02-28 14:29:09 +00:00
parent ae6c23ae2c
commit af1c6ecdc7
3 changed files with 16 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2005-02-28 Peter Stephenson <pws@csr.com>
* 20888: Doc/Zsh/builtins.yo, Src/jobs.c: allow the prefix
SIG in signal names used with the trap and kill builtins, for
compatibility.
2005-02-26 Andrey Borzenkov <bor@zsh.org>
* 20872: Src/Zle/zle_utils.c, Src/Zle/zle_vi.c, Src/Zle/zle_word.c:

View file

@ -1157,8 +1157,9 @@ cindex(trapping signals)
item(tt(trap) [ var(arg) [ var(sig) ... ] ])(
var(arg) is a series of commands (usually quoted to protect it from
immediate evaluation by the shell) to be read and executed when the shell
receives var(sig). Each var(sig) can be given as a number
or as the name of a signal.
receives var(sig). Each var(sig) can be given as a number,
or as the name of a signal either with or without the string tt(SIG)
in front.
If var(arg) is `tt(-)', then all traps var(sig) are reset to their
default values. If var(arg) is the empty string, then this signal
is ignored by the shell and by the commands it invokes.

View file

@ -1874,6 +1874,8 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
while (*++argv) {
sig = zstrtol(*argv, &signame, 10);
if (signame == *argv) {
if (!strncmp(signame, "SIG", 3))
signame += 3;
for (sig = 1; sig <= SIGCOUNT; sig++)
if (!cstrpcmp(sigs + sig, &signame))
break;
@ -1942,7 +1944,8 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
} else
signame = *argv;
makeuppercase(&signame);
if (!strncmp(signame, "SIG", 3)) signame+=3;
if (!strncmp(signame, "SIG", 3))
signame+=3;
/* check for signal matching specified name */
for (sig = 1; sig <= SIGCOUNT; sig++)
@ -2032,6 +2035,9 @@ getsignum(char *s)
return x;
/* search for signal by name */
if (!strncmp(s, "SIG", 3))
s += 3;
for (i = 0; i < VSIGCOUNT; i++)
if (!strcmp(s, sigs[i]))
return i;