[hackers] [sbase] kill -l accepts at most 1 arg || sin

From: <git_AT_suckless.org>
Date: Tue, 11 Nov 2014 17:08:33 +0100

commit a81544a8102c588de8b40ba823294fe3f982d96f
Author: sin <sin_AT_2f30.org>
Date: Tue Nov 11 16:08:13 2014 +0000

    kill -l accepts at most 1 arg

diff --git a/kill.1 b/kill.1
index 0a41827..d248d9f 100644
--- a/kill.1
+++ b/kill.1
_AT_@ -4,7 +4,7 @@ KILL \- signal processes
 .SH SYNOPSIS
 \fBkill\fR [ \fB-s\fR \fIsignal_name\fR ] \fIpid\fR \fI...\fR
 .P
-\fBkill\fR \fB-l\fR [ \fIexit_status\fR \fI...\fR]
+\fBkill\fR \fB-l\fR [ \fIexit_status\fR]
 .P
 \fBkill\fR \fB-\fR\fIsignal_name\fR \fIpid\fR \fI...\fR
 .P
diff --git a/kill.c b/kill.c
index ccc6a10..2ab0af8 100644
--- a/kill.c
+++ b/kill.c
_AT_@ -28,7 +28,7 @@ static void
 usage(void)
 {
         weprintf("usage: %s [-s signame | -signum | -signame] pid ...\n", argv0);
- weprintf(" %s -l [exit_status ...]\n", argv0);
+ weprintf(" %s -l [exit_status]\n", argv0);
         exit(1);
 }
 
_AT_@ -72,19 +72,16 @@ main(int argc, char *argv[])
                                 puts(sigs[i].name);
                         exit(0);
                 }
- for (; argc; argc--, argv++) {
- errno = 0;
- sig = strtol(argv[0], &end, 0);
- if (*end == '\0' && errno == 0) {
- name = sig2name(sig);
- if (!name)
- printf("%d\n", sig);
- else
- puts(name);
- } else {
- weprintf("%s: bad signal number\n", argv[0]);
- ret = 1;
- }
+ errno = 0;
+ sig = strtol(argv[0], &end, 0);
+ if (*end == '\0' && errno == 0) {
+ name = sig2name(sig);
+ if (!name)
+ eprintf("%d: bad signal number\n", sig);
+ else
+ puts(name);
+ } else {
+ eprintf("%s: bad signal name\n", argv[0]);
                 }
                 exit(0);
         } else {
_AT_@ -108,7 +105,7 @@ main(int argc, char *argv[])
                                 }
                         }
                         if (i == LEN(sigs))
- eprintf("%s: bad signal number\n", name);
+ eprintf("%s: bad signal name\n", name);
                 }
                 argc--;
                 argv++;
Received on Tue Nov 11 2014 - 17:08:33 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 11 2014 - 17:12:09 CET