aboutsummaryrefslogtreecommitdiff
path: root/kill.c
diff options
context:
space:
mode:
Diffstat (limited to 'kill.c')
-rw-r--r--kill.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/kill.c b/kill.c
index 8a99e0f9e..10343a150 100644
--- a/kill.c
+++ b/kill.c
@@ -36,11 +36,12 @@ static const char *kill_usage =
36 "Send a signal (default is SIGTERM) to the specified process(es).\n\n" 36 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"
37 "Options:\n" "\t-l\tList all signal names and numbers.\n\n"; 37 "Options:\n" "\t-l\tList all signal names and numbers.\n\n";
38 38
39#ifdef BB_KILLALL
39static const char *killall_usage = 40static const char *killall_usage =
40 "killall [-signal] process-name [process-name ...]\n\n" 41 "killall [-signal] process-name [process-name ...]\n\n"
41 "Send a signal (default is SIGTERM) to the specified process(es).\n\n" 42 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"
42 "Options:\n" "\t-l\tList all signal names and numbers.\n\n"; 43 "Options:\n" "\t-l\tList all signal names and numbers.\n\n";
43 44#endif
44 45
45#define KILL 0 46#define KILL 0
46#define KILLALL 1 47#define KILLALL 1
@@ -132,10 +133,15 @@ extern int kill_main(int argc, char **argv)
132 int whichApp, sig = SIGTERM; 133 int whichApp, sig = SIGTERM;
133 const char *appUsage; 134 const char *appUsage;
134 135
136#ifdef BB_KILLALL
135 /* Figure out what we are trying to do here */ 137 /* Figure out what we are trying to do here */
136 whichApp = (strcmp(*argv, "killall") == 0)? 138 whichApp = (strcmp(*argv, "killall") == 0)?
137 KILLALL : KILL; 139 KILLALL : KILL;
138 appUsage = (whichApp == KILLALL)? killall_usage : kill_usage; 140 appUsage = (whichApp == KILLALL)? killall_usage : kill_usage;
141#else
142 whichApp = KILL;
143 appUsage = kill_usage;
144#endif
139 145
140 argc--; 146 argc--;
141 argv++; 147 argv++;
@@ -213,7 +219,9 @@ extern int kill_main(int argc, char **argv)
213 fatalError( "Could not kill pid '%d': %s\n", pid, strerror(errno)); 219 fatalError( "Could not kill pid '%d': %s\n", pid, strerror(errno));
214 argv++; 220 argv++;
215 } 221 }
216 } else { 222 }
223#ifdef BB_KILLALL
224 else {
217 /* Looks like they want to do a killall. Do that */ 225 /* Looks like they want to do a killall. Do that */
218 while (--argc >= 0) { 226 while (--argc >= 0) {
219 int pid; 227 int pid;
@@ -225,6 +233,7 @@ extern int kill_main(int argc, char **argv)
225 argv++; 233 argv++;
226 } 234 }
227 } 235 }
236#endif
228 237
229 exit(TRUE); 238 exit(TRUE);
230 239