* Copyright (c) 1988 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
"@(#) Copyright (c) 1988 Regents of the University of California.\n\
static char sccsid
[] = "@(#)kill.c 4.5 (Berkeley) %G%";
static char *signals
[] = {
"hup", "int", "quit", "ill", "trap", "iot", /* 1 - 6 */
"emt", "fpe", "kill", "bus", "segv", "sys", /* 7 - 12 */
"pipe", "alrm", "term", "urg", "stop", "tstp", /* 13 - 18 */
"cont", "chld", "ttin", "ttou", "io", "xcpu", /* 19 - 24 */
"xfsz", "vtalrm", "prof", "winch", "29", "usr1", /* 25 - 30 */
"usr2", NULL
, /* 31 - 32 */
if (!strcmp(*++argv
, "-l")) {
if (!strncasecmp(*argv
, "sig", 3))
for (p
= signals
;; ++p
) {
if (!strcasecmp(*p
, *argv
)) {
numsig
= p
- signals
+ 1;
else if (isdigit(**argv
)) {
if (numsig
<= 0 || numsig
> NSIG
)
error
: printf("kill: unknown signal %s; valid signals:\n", *argv
);
for (errors
= 0; *argv
; ++argv
) {
if (kill(atoi(*argv
), numsig
) == -1) {
for (p
= signals
; *p
; ++p
) {
if ((p
- signals
) == NSIG
/ 2 - 1)
printf("usage: kill [-l] [-sig] pid ...\n");