+
+ if(!u_signal_names(argv[1]+1, &signo, 0))
+ bb_error_msg_and_die( "bad signal name '%s'", argv[1]+1);
+ argv+=2;
+ argc-=2;
+
+do_it_now:
+
+ if (whichApp == KILL) {
+ /* Looks like they want to do a kill. Do that */
+ while (--argc >= 0) {
+ int pid;
+
+ if (!isdigit(**argv))
+ bb_error_msg_and_die( "Bad PID '%s'", *argv);
+ pid = strtol(*argv, NULL, 0);
+ if (kill(pid, signo) != 0) {
+ bb_perror_msg( "Could not kill pid '%d'", pid);
+ errors++;
+ }
+ argv++;
+ }
+
+ }
+#ifdef CONFIG_KILLALL
+ else {
+ pid_t myPid=getpid();
+ /* Looks like they want to do a killall. Do that */
+ while (--argc >= 0) {
+ long* pidList;
+
+ pidList = find_pid_by_name(*argv);
+ if (!pidList || *pidList<=0) {
+ errors++;
+ if (quiet==0)
+ bb_error_msg( "%s: no process killed", *argv);
+ } else {
+ long *pl;
+
+ for(pl = pidList; *pl !=0 ; pl++) {
+ if (*pl==myPid)
+ continue;
+ if (kill(*pl, signo) != 0) {
+ errors++;
+ if (quiet==0)
+ bb_perror_msg( "Could not kill pid '%ld'", *pl);
+ }
+ }
+ }
+ free(pidList);
+ argv++;
+ }
+ }
+#endif
+ return errors;