about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Unix/Type/_signals3
-rw-r--r--Src/jobs.c24
3 files changed, 27 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c7ffede8..f33d1bf55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-12-21  Oliver Kiddle  <opk@zsh.org>
+
+	* 16372: Src/jobs.c, Completion/Unix/Type/_signals: allow signals
+	to be specified with `SIG' prefix to kill builtin and fix bug with
+	lack of argument to kill -n/-s.
+
 2001-12-21  Geoff Wing  <gcw@zsh.org>
 
 	* 16332: zshconfig.ac, Config/defs.mk.in, Src/Makefile.in,
diff --git a/Completion/Unix/Type/_signals b/Completion/Unix/Type/_signals
index f882ca9ff..32cb8285c 100644
--- a/Completion/Unix/Type/_signals
+++ b/Completion/Unix/Type/_signals
@@ -21,9 +21,10 @@ fi
 
 if [[ -z "$minus" ]] ||
    ! zstyle -T ":completion:${curcontext}:signals" prefix-needed ||
-   [[ "$PREFIX" = -* ]]; then
+   [[ -prefix -* ]]; then
   local disp tmp
 
+  [[ -prefix ${minus}SIG* ]] && minus+=SIG
   if zstyle -t ":completion:${curcontext}:signals" prefix-hidden; then
     tmp=( "${(@)signals[1,last]}" )
     disp=(-d tmp)
diff --git a/Src/jobs.c b/Src/jobs.c
index f3519ae2c..fc3737fa9 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1504,20 +1504,29 @@ bin_kill(char *nam, char **argv, char *ops, int func)
     	    if ((*argv)[1] == 'n' && (*argv)[2] == '\0') {
 	    	char *endp;
 
-	    	sig = zstrtol(*++argv, &endp, 10);
+	    	if (!*++argv) {
+		    zwarnnam(nam, "-n: argument expected", NULL, 0);
+		    return 1;
+		}
+		sig = zstrtol(*argv, &endp, 10);
 		if (*endp) {
 		    zwarnnam(nam, "invalid signal number", signame, 0);
 		    return 1;
 		}
 	    } else {
-		if ((*argv)[1] == 's' && (*argv)[2] == '\0')
-		    signame = *++argv;
-		else
+		if (!((*argv)[1] == 's' && (*argv)[2] == '\0'))
 		    signame = *argv + 1;
+		else if (!(*++argv)) {
+		    zwarnnam(nam, "-s: argument expected", NULL, 0);
+		    return 1;
+		} else
+		    signame = *argv;
+		makeuppercase(&signame);
+		if (!strncmp(signame, "SIG", 3)) signame+=3;
 
 		/* check for signal matching specified name */
 		for (sig = 1; sig <= SIGCOUNT; sig++)
-		    if (!cstrpcmp(sigs + sig, &signame))
+		    if (!strcmp(*(sigs + sig), signame))
 			break;
 		if (*signame == '0' && !signame[1])
 		    sig = 0;
@@ -1531,6 +1540,11 @@ bin_kill(char *nam, char **argv, char *ops, int func)
 	argv++;
     }
 
+    if (!*argv) {
+    	zwarnnam(nam, "not enough arguments", NULL, 0);
+	return 1;
+    }
+
     queue_signals();
     setcurjob();