about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Doc/Zsh/builtins.yo5
-rw-r--r--Src/jobs.c8
3 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 65f2b3452..493a41e79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index d5a0f787f..e4115e3da 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -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.
diff --git a/Src/jobs.c b/Src/jobs.c
index 429485b9e..5c1574acf 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -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;