[BusyBox] [PATCH] trivial fix for killall usage and code clean up for kill.c if CONFIG_KILLALL is not set.

Tito farmatito at tiscali.it
Tue Aug 17 14:25:18 UTC 2004


Hi to the list.
just two trivial fixes that sholud be applied before 1.0.
The first adds a missing option to killal full and trivial usage (-q).
The second ifdef's out some code from kill.c that is not
used if  CONFIG_KILLALL is not set so reducing the size
of the binary in this case.

I tested this a bit and it seems to me that these patches do not break things.
( I hope.......).

Take a look at them and please apply if you feel it is ok to do so.
Ciao,
TIto
-------------- next part --------------
--- procps/kill_orig.c	2004-08-17 14:08:26.141180104 +0000
+++ procps/kill.c	2004-08-17 14:06:17.914673496 +0000
@@ -37,11 +37,12 @@
 
 extern int kill_main(int argc, char **argv)
 {
-	int whichApp, signo = SIGTERM, quiet = 0;
+	int whichApp, signo = SIGTERM;
 	const char *name;
 	int errors = 0;
 
 #ifdef CONFIG_KILLALL
+	int quiet=0;
 	/* Figure out what we are trying to do here */
 	whichApp = (strcmp(bb_applet_name, "killall") == 0)? KILLALL : KILL;
 #else
@@ -86,6 +87,7 @@
 		return EXIT_SUCCESS;
 	}
 
+#ifdef CONFIG_KILLALL	
 	/* The -q quiet option */
 	if(argv[1][1]=='q' && argv[1][2]=='\0'){
 		quiet++;
@@ -95,6 +97,7 @@
 			goto do_it_now;
 		}
 	}
+#endif
 
 	if(!u_signal_names(argv[1]+1, &signo, 0))
 		bb_error_msg_and_die( "bad signal name '%s'", argv[1]+1);
-------------- next part --------------
--- include/usage.orig.h	2004-08-17 13:58:28.194081880 +0000
+++ include/usage.h	2004-08-17 14:20:10.324128024 +0000
@@ -1371,11 +1371,12 @@
 	"$ kill 252\n"
 
 #define killall_trivial_usage \
-	"[-signal] process-name [process-name ...]"
+	"[-q] [-signal] process-name [process-name ...]"
 #define killall_full_usage \
 	"Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
 	"Options:\n" \
-	"\t-l\tList all signal names and numbers."
+	"\t-l\tList all signal names and numbers.\n"\
+	"\t-q\tDo not complain if no processes were killed."
 #define killall_example_usage \
 	"$ killall apache\n"
 


More information about the busybox mailing list