3 * Copyright (c) 1993 by David I. Bell
4 * Copyright (C) 1999, Rt-Control Inc.
5 * Copyright (C) 2000 Lineo, Inc. (www.lineo.com)
7 * Permission is granted to use, distribute, or modify this source,
8 * provided that this copyright notice remains intact.
12 #include <sys/types.h>
29 #define isdecimal(X) ((X) >= '0' && (X) <= '9' ? 1 : 0)
42 if (argv[1][0] == '-') {
44 if (strcmp(cp, "HUP") == 0)
46 else if (strcmp(cp, "INT") == 0)
48 else if (strcmp(cp, "QUIT") == 0)
50 else if (strcmp(cp, "ILL") == 0)
52 else if (strcmp(cp, "TRAP") == 0)
54 else if (strcmp(cp, "ABRT") == 0)
56 else if (strcmp(cp, "IOT") == 0)
58 else if (strcmp(cp, "BUS") == 0)
60 else if (strcmp(cp, "FPE") == 0)
62 else if (strcmp(cp, "KILL") == 0)
64 else if (strcmp(cp, "USR1") == 0)
66 else if (strcmp(cp, "SEGV") == 0)
68 else if (strcmp(cp, "USR2") == 0)
70 else if (strcmp(cp, "PIPE") == 0)
72 else if (strcmp(cp, "ALRM") == 0)
74 else if (strcmp(cp, "TERM") == 0)
76 else if (strcmp(cp, "STKFLT") == 0)
78 else if (strcmp(cp, "CHLD") == 0)
80 else if (strcmp(cp, "CONT") == 0)
82 else if (strcmp(cp, "STOP") == 0)
84 else if (strcmp(cp, "TSTP") == 0)
86 else if (strcmp(cp, "TTIN") == 0)
88 else if (strcmp(cp, "TTOU") == 0)
90 else if (strcmp(cp, "URG") == 0)
92 else if (strcmp(cp, "PWR") == 0)
96 while (isdecimal(*cp))
97 sig = sig * 10 + *cp++ - '0';
100 write(2, "Unknown signal\n", strlen("Unknown signal\n"));
111 while (isdecimal(*cp))
112 pid = pid * 10 + *cp++ - '0';
115 write(2, "Non-numeric pid\n", strlen("Non-numeric pid\n"));
119 if (kill(pid, sig) < 0)