diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-31 00:30:48 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-31 00:30:48 +0000 |
commit | b9b344aa44ba6221edc8f09398325399049bf388 (patch) | |
tree | 0fb8f61e9ec11b39c0fc8e9d9358ca33d5b9c1b4 | |
parent | f34cfff2f032ff8e475c97f69ea49a24f94b64f5 (diff) | |
download | busybox-w32-b9b344aa44ba6221edc8f09398325399049bf388.tar.gz busybox-w32-b9b344aa44ba6221edc8f09398325399049bf388.tar.bz2 busybox-w32-b9b344aa44ba6221edc8f09398325399049bf388.zip |
kill[all[5]]: accept -s SIG too. kill_main: +29 bytes
by Steve Bennett (steveb AT workware.net.au)
-rw-r--r-- | include/usage.h | 13 | ||||
-rw-r--r-- | procps/kill.c | 10 |
2 files changed, 15 insertions, 8 deletions
diff --git a/include/usage.h b/include/usage.h index 9e18ff640..ac62fbf6d 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -2041,11 +2041,12 @@ | |||
2041 | "\n -u Unicode (utf-8)" \ | 2041 | "\n -u Unicode (utf-8)" \ |
2042 | 2042 | ||
2043 | #define kill_trivial_usage \ | 2043 | #define kill_trivial_usage \ |
2044 | "[-l] [-signal] process-id..." | 2044 | "[-l] [-SIG] PID..." |
2045 | #define kill_full_usage "\n\n" \ | 2045 | #define kill_full_usage "\n\n" \ |
2046 | "Send a signal (default is TERM) to the specified process(es)\n" \ | 2046 | "Send a signal (default is TERM) to given PIDs\n" \ |
2047 | "\nOptions:" \ | 2047 | "\nOptions:" \ |
2048 | "\n -l List all signal names and numbers" \ | 2048 | "\n -l List all signal names and numbers" \ |
2049 | /* "\n -s SIG Yet another way of specifying SIG" */ \ | ||
2049 | 2050 | ||
2050 | #define kill_example_usage \ | 2051 | #define kill_example_usage \ |
2051 | "$ ps | grep apache\n" \ | 2052 | "$ ps | grep apache\n" \ |
@@ -2058,22 +2059,24 @@ | |||
2058 | "$ kill 252\n" | 2059 | "$ kill 252\n" |
2059 | 2060 | ||
2060 | #define killall_trivial_usage \ | 2061 | #define killall_trivial_usage \ |
2061 | "[-l] [-q] [-signal] process-name..." | 2062 | "[-l] [-q] [-SIG] process-name..." |
2062 | #define killall_full_usage "\n\n" \ | 2063 | #define killall_full_usage "\n\n" \ |
2063 | "Send a signal (default is TERM) to the specified process(es)\n" \ | 2064 | "Send a signal (default is TERM) to given processes\n" \ |
2064 | "\nOptions:" \ | 2065 | "\nOptions:" \ |
2065 | "\n -l List all signal names and numbers" \ | 2066 | "\n -l List all signal names and numbers" \ |
2067 | /* "\n -s SIG Yet another way of specifying SIG" */ \ | ||
2066 | "\n -q Do not complain if no processes were killed" \ | 2068 | "\n -q Do not complain if no processes were killed" \ |
2067 | 2069 | ||
2068 | #define killall_example_usage \ | 2070 | #define killall_example_usage \ |
2069 | "$ killall apache\n" | 2071 | "$ killall apache\n" |
2070 | 2072 | ||
2071 | #define killall5_trivial_usage \ | 2073 | #define killall5_trivial_usage \ |
2072 | "[-l] [-signal]" | 2074 | "[-l] [-SIG]" |
2073 | #define killall5_full_usage "\n\n" \ | 2075 | #define killall5_full_usage "\n\n" \ |
2074 | "Send a signal (default is TERM) to all processes outside current session\n" \ | 2076 | "Send a signal (default is TERM) to all processes outside current session\n" \ |
2075 | "\nOptions:" \ | 2077 | "\nOptions:" \ |
2076 | "\n -l List all signal names and numbers" \ | 2078 | "\n -l List all signal names and numbers" \ |
2079 | /* "\n -s SIG Yet another way of specifying SIG" */ \ | ||
2077 | 2080 | ||
2078 | #define klogd_trivial_usage \ | 2081 | #define klogd_trivial_usage \ |
2079 | "[-c N] [-n]" | 2082 | "[-c N] [-n]" |
diff --git a/procps/kill.c b/procps/kill.c index ed659afdc..140550018 100644 --- a/procps/kill.c +++ b/procps/kill.c | |||
@@ -96,10 +96,14 @@ int kill_main(int argc, char **argv) | |||
96 | if (arg[0] != '-') goto do_it_now; | 96 | if (arg[0] != '-') goto do_it_now; |
97 | } | 97 | } |
98 | 98 | ||
99 | /* -SIG */ | 99 | arg++; /* skip '-' */ |
100 | signo = get_signum(&arg[1]); | 100 | if (argc > 1 && arg[0] == 's' && arg[1] == '\0') { /* -s SIG? */ |
101 | argc--; | ||
102 | arg = *++argv; | ||
103 | } /* else it must be -SIG */ | ||
104 | signo = get_signum(arg); | ||
101 | if (signo < 0) { /* || signo > MAX_SIGNUM ? */ | 105 | if (signo < 0) { /* || signo > MAX_SIGNUM ? */ |
102 | bb_error_msg("bad signal name '%s'", &arg[1]); | 106 | bb_error_msg("bad signal name '%s'", arg); |
103 | return EXIT_FAILURE; | 107 | return EXIT_FAILURE; |
104 | } | 108 | } |
105 | arg = *++argv; | 109 | arg = *++argv; |