* Add support for POSIX "kill [-s signame] pid" syntax; actually fixes PR 5327.
* Complete the "kill -l [exitstatus]" syntax. * Sync with the documentation and no longer permit the use of full signal names in the "kill [-sig] pid" syntax, e.g. -SIGHUP.
This commit is contained in:
parent
ca01c95791
commit
892884f299
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: csh.1,v 1.15 1997/10/20 08:46:18 enami Exp $
|
||||
.\" $NetBSD: csh.1,v 1.16 1998/05/10 18:32:46 kleink Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -1323,15 +1323,20 @@ Lists the active jobs; the
|
|||
option lists process id's in addition to the normal information.
|
||||
.Pp
|
||||
.It Ic kill % Ns Ar job
|
||||
.It Ic kill Ar pid
|
||||
.It Ic kill
|
||||
.Op Fl s Ar signal_name
|
||||
.Ar pid
|
||||
.It Ic kill Fl sig Ar pid ...
|
||||
.It Ic kill Fl l
|
||||
.It Ic kill Fl l Op exit_status
|
||||
Sends either the TERM (terminate) signal or the
|
||||
specified signal to the specified jobs or processes.
|
||||
Signals are either given by number or by names (as given in
|
||||
.Pa /usr/include/signal.h,
|
||||
.Aq Pa signal.h ,
|
||||
stripped of the prefix ``SIG'').
|
||||
The signal names are listed by ``kill \-l''.
|
||||
The signal names are listed by ``kill \-l'';
|
||||
if an
|
||||
.Ar exit_status
|
||||
is specified, only the corresponding signal name will be written.
|
||||
There is no default, just saying `kill' does not
|
||||
send a signal to the current job.
|
||||
If the signal being sent is TERM (terminate) or HUP (hangup),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: proc.c,v 1.11 1997/07/04 21:24:07 christos Exp $ */
|
||||
/* $NetBSD: proc.c,v 1.12 1998/05/10 18:32:46 kleink Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)proc.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: proc.c,v 1.11 1997/07/04 21:24:07 christos Exp $");
|
||||
__RCSID("$NetBSD: proc.c,v 1.12 1998/05/10 18:32:46 kleink Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -979,10 +979,23 @@ dokill(v, t)
|
|||
v++;
|
||||
if (v[0] && v[0][0] == '-') {
|
||||
if (v[0][1] == 'l') {
|
||||
for (signum = 1; signum < NSIG; signum++) {
|
||||
(void) fprintf(cshout, "%s ", sys_signame[signum]);
|
||||
if (signum == NSIG / 2)
|
||||
(void) fputc('\n', cshout);
|
||||
if (v[1]) {
|
||||
if (!Isdigit(v[1][0]))
|
||||
stderror(ERR_NAME | ERR_BADSIG);
|
||||
|
||||
signum = atoi(short2str(v[1]));
|
||||
if (signum < 0 || signum >= NSIG)
|
||||
stderror(ERR_NAME | ERR_BADSIG);
|
||||
else if (signum == 0)
|
||||
(void) fputc('0', cshout); /* 0's symbolic name is '0' */
|
||||
else
|
||||
(void) fprintf(cshout, "%s ", sys_signame[signum]);
|
||||
} else {
|
||||
for (signum = 1; signum < NSIG; signum++) {
|
||||
(void) fprintf(cshout, "%s ", sys_signame[signum]);
|
||||
if (signum == NSIG / 2)
|
||||
(void) fputc('\n', cshout);
|
||||
}
|
||||
}
|
||||
(void) fputc('\n', cshout);
|
||||
return;
|
||||
|
@ -993,17 +1006,28 @@ dokill(v, t)
|
|||
stderror(ERR_NAME | ERR_BADSIG);
|
||||
}
|
||||
else {
|
||||
name = short2str(&v[0][1]);
|
||||
if (!strncasecmp(name, "sig", 3))
|
||||
name += 3;
|
||||
if (v[0][1] == 's' && (Isspace(v[0][2]) || v[0][2] == '\0'))
|
||||
v++;
|
||||
else
|
||||
(*v)++;
|
||||
|
||||
if (v[0] == NULL || v[1] == NULL) {
|
||||
stderror(ERR_NAME | ERR_TOOFEW);
|
||||
return;
|
||||
}
|
||||
|
||||
name = short2str(&v[0][0]);
|
||||
for (signum = 1; signum < NSIG; signum++)
|
||||
if (!strcasecmp(sys_signame[signum], name))
|
||||
break;
|
||||
|
||||
if (signum == NSIG) {
|
||||
setname(vis_str(&v[0][1]));
|
||||
stderror(ERR_NAME | ERR_UNKSIG);
|
||||
if (v[0][0] == '0')
|
||||
signum = 0;
|
||||
else {
|
||||
setname(vis_str(&v[0][0]));
|
||||
stderror(ERR_NAME | ERR_UNKSIG);
|
||||
}
|
||||
}
|
||||
}
|
||||
v++;
|
||||
|
|
Loading…
Reference in New Issue