kill -l accepts at most 1 arg
This commit is contained in:
parent
aee8535a71
commit
a81544a810
2
kill.1
2
kill.1
|
@ -4,7 +4,7 @@ KILL \- signal processes
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fBkill\fR [ \fB-s\fR \fIsignal_name\fR ] \fIpid\fR \fI...\fR
|
\fBkill\fR [ \fB-s\fR \fIsignal_name\fR ] \fIpid\fR \fI...\fR
|
||||||
.P
|
.P
|
||||||
\fBkill\fR \fB-l\fR [ \fIexit_status\fR \fI...\fR]
|
\fBkill\fR \fB-l\fR [ \fIexit_status\fR]
|
||||||
.P
|
.P
|
||||||
\fBkill\fR \fB-\fR\fIsignal_name\fR \fIpid\fR \fI...\fR
|
\fBkill\fR \fB-\fR\fIsignal_name\fR \fIpid\fR \fI...\fR
|
||||||
.P
|
.P
|
||||||
|
|
11
kill.c
11
kill.c
|
@ -28,7 +28,7 @@ static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
weprintf("usage: %s [-s signame | -signum | -signame] pid ...\n", argv0);
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,19 +72,16 @@ main(int argc, char *argv[])
|
||||||
puts(sigs[i].name);
|
puts(sigs[i].name);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
for (; argc; argc--, argv++) {
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
sig = strtol(argv[0], &end, 0);
|
sig = strtol(argv[0], &end, 0);
|
||||||
if (*end == '\0' && errno == 0) {
|
if (*end == '\0' && errno == 0) {
|
||||||
name = sig2name(sig);
|
name = sig2name(sig);
|
||||||
if (!name)
|
if (!name)
|
||||||
printf("%d\n", sig);
|
eprintf("%d: bad signal number\n", sig);
|
||||||
else
|
else
|
||||||
puts(name);
|
puts(name);
|
||||||
} else {
|
} else {
|
||||||
weprintf("%s: bad signal number\n", argv[0]);
|
eprintf("%s: bad signal name\n", argv[0]);
|
||||||
ret = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -108,7 +105,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == LEN(sigs))
|
if (i == LEN(sigs))
|
||||||
eprintf("%s: bad signal number\n", name);
|
eprintf("%s: bad signal name\n", name);
|
||||||
}
|
}
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user