From: Sami Kerola Date: Tue, 15 Apr 2014 10:40:33 +0000 (+0100) Subject: kill: add --verbose option to display what is killed X-Git-Tag: v2.25-rc1~244^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1fd774289b821b28676a5f7ad6536aba15d6fc8;p=thirdparty%2Futil-linux.git kill: add --verbose option to display what is killed Signed-off-by: Sami Kerola --- diff --git a/misc-utils/kill.c b/misc-utils/kill.c index 9566f14580..b30b94fe4e 100644 --- a/misc-utils/kill.c +++ b/misc-utils/kill.c @@ -78,7 +78,8 @@ struct kill_control { check_all:1, do_kill:1, do_pid:1, - use_sigval:1; + use_sigval:1, + verbose:1; }; struct signv { @@ -314,6 +315,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out) fputs(_(" -p, --pid print pids without signaling them\n"), out); fputs(_(" -l, --list [=] list signal names, or convert one to a name\n"), out); fputs(_(" -L, --table list signal names and numbers\n"), out); + fputs(_(" --verbose print pids that will be signaled\n"), out); fputs(USAGE_SEPARATOR, out); fputs(USAGE_HELP, out); @@ -345,7 +347,10 @@ static char **parse_arguments(int argc, char **argv, struct kill_control *ctl) } if (!strcmp(arg, "-h") || !strcmp(arg, "--help")) usage(stdout); - + if (!strcmp(arg, "--verbose")) { + ctl->verbose = 1; + continue; + } if (!strcmp(arg, "-a") || !strcmp(arg, "--all")) { ctl->check_all = 1; continue; @@ -442,6 +447,8 @@ static int kill_verbose(const struct kill_control *ctl) { int rc = 0; + if (ctl->verbose) + printf(_("sending signal %d to pid %d\n"), ctl->numsig, ctl->pid); if (ctl->do_pid) { printf("%ld\n", (long) ctl->pid); return 0;