diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2001-11-06 15:06:59 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2001-11-06 15:06:59 +0000 |
commit | d39feeffc48330e4b16768f881306b75e7673971 (patch) | |
tree | 4a950e123288fdfa52283c79c048c2949eed228d /Src | |
parent | 42f096be3422e46695798a01c7571bf0515ef1d6 (diff) | |
download | zsh-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.c | 39 |
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++; |