diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-06 22:48:55 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-06 22:48:55 +0000 |
commit | 02f47e9f8140e5b4e83f691df21a542f0651ab15 (patch) | |
tree | 4965e1bfef019fb2587bee2154c3605b501a5a02 | |
parent | 21f0d4c55eceaf24f4f7e2b679032c55a104f1ac (diff) | |
download | busybox-02f47e9f8140e5b4e83f691df21a542f0651ab15.tar.gz |
kill: fix recent breakage of vda, also make code smaller by 21 bytes.
-rw-r--r-- | procps/kill.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/procps/kill.c b/procps/kill.c index b3257492d..3ccbd30e4 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * Mini kill/killall implementation for busybox + * Mini kill/killall[5] implementation for busybox * * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>. * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> @@ -30,10 +30,17 @@ int kill_main(int argc, char **argv) char *arg; pid_t pid; int signo = SIGTERM, errors = 0, quiet = 0; - const int killall = (ENABLE_KILLALL && argv[0][4] == 'a' - && (!ENABLE_KILLALL5 || argv[0][7] != '5')); - const int killall5 = (ENABLE_KILLALL5 && argv[0][4] == 'a' - && (!ENABLE_KILLALL || argv[0][7] == '5')); +#if !ENABLE_KILLALL && !ENABLE_KILLALL5 +#define killall 0 +#define killall5 0 +#else +/* How to determine who we are? find 3rd char from the end: + * kill, killall, killall5 + * ^i ^a ^l */ + const char char3 = argv[0][strlen(argv[0]) - 3]; +#define killall (ENABLE_KILLALL && char3 == 'a') +#define killall5 (ENABLE_KILLALL5 && char3 == 'l') +#endif /* Parse any options */ argc--; |