commit a81544a8102c588de8b40ba823294fe3f982d96f
parent aee8535a71525195e92478f69511cec4e749d97c
Author: sin <sin@2f30.org>
Date: Tue, 11 Nov 2014 16:08:13 +0000
kill -l accepts at most 1 arg
Diffstat:
2 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/kill.1 b/kill.1
@@ -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
@@ -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);
}
@@ -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 {
@@ -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++;