about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2001-11-06 15:06:59 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2001-11-06 15:06:59 +0000
commitd39feeffc48330e4b16768f881306b75e7673971 (patch)
tree4a950e123288fdfa52283c79c048c2949eed228d /Src
parent42f096be3422e46695798a01c7571bf0515ef1d6 (diff)
downloadzsh-d39feeffc48330e4b16768f881306b75e7673971.tar.gz
zsh-d39feeffc48330e4b16768f881306b75e7673971.tar.xz
zsh-d39feeffc48330e4b16768f881306b75e7673971.zip
16224: add -n option to kill and complete options from _kill
Diffstat (limited to 'Src')
-rw-r--r--Src/jobs.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/Src/jobs.c b/Src/jobs.c
index f462a0ae8..f3519ae2c 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1500,21 +1500,32 @@ bin_kill(char *nam, char **argv, char *ops, int func)
 		putchar('\n');
 		return 0;
 	    }
-	    if ((*argv)[1] == 's' && (*argv)[2] == '\0')
-		signame = *++argv;
-	    else
-		signame = *argv + 1;
 
-	    /* check for signal matching specified name */
-	    for (sig = 1; sig <= SIGCOUNT; sig++)
-		if (!cstrpcmp(sigs + sig, &signame))
-		    break;
-	    if (*signame == '0' && !signame[1])
-		sig = 0;
-	    if (sig > SIGCOUNT) {
-		zwarnnam(nam, "unknown signal: SIG%s", signame, 0);
-		zwarnnam(nam, "type kill -l for a List of signals", NULL, 0);
-		return 1;
+    	    if ((*argv)[1] == 'n' && (*argv)[2] == '\0') {
+	    	char *endp;
+
+	    	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
+		    signame = *argv + 1;
+
+		/* check for signal matching specified name */
+		for (sig = 1; sig <= SIGCOUNT; sig++)
+		    if (!cstrpcmp(sigs + sig, &signame))
+			break;
+		if (*signame == '0' && !signame[1])
+		    sig = 0;
+		if (sig > SIGCOUNT) {
+		    zwarnnam(nam, "unknown signal: SIG%s", signame, 0);
+		    zwarnnam(nam, "type kill -l for a List of signals", NULL, 0);
+		    return 1;
+		}
 	    }
 	}
 	argv++;