From: Karel Zak Date: Mon, 9 Dec 2019 11:40:53 +0000 (+0100) Subject: kill: report features on -V, add lish_header initialization X-Git-Tag: v2.35-rc1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26c2ad6c38711b3bca269cf9e6be2d5479f0455c;p=thirdparty%2Futil-linux.git kill: report features on -V, add lish_header initialization Signed-off-by: Karel Zak --- diff --git a/misc-utils/kill.c b/misc-utils/kill.c index 1a1715cc40..cf4e711545 100644 --- a/misc-utils/kill.c +++ b/misc-utils/kill.c @@ -218,6 +218,32 @@ static void __attribute__((__noreturn__)) usage(void) exit(EXIT_SUCCESS); } +static void __attribute__((__noreturn__)) print_kill_version(void) +{ + static const char *features[] = { +#ifdef HAVE_SIGQUEUE + "sigqueue", +#endif +#ifdef UL_HAVE_PIDFD + "pidfd", +#endif + }; + + printf(_("%s from %s"), program_invocation_short_name, PACKAGE_STRING); + + if (ARRAY_SIZE(features)) { + size_t i; + fputs(_(" (with: "), stdout); + for (i = 0; i < ARRAY_SIZE(features); i++) { + fputs(features[i], stdout); + if (i + 1 < ARRAY_SIZE(features)) + fputs(", ", stdout); + } + fputs(")\n", stdout); + } + exit(EXIT_SUCCESS); +} + static char **parse_arguments(int argc, char **argv, struct kill_control *ctl) { char *arg; @@ -235,7 +261,7 @@ static char **parse_arguments(int argc, char **argv, struct kill_control *ctl) } if (!strcmp(arg, "-v") || !strcmp(arg, "-V") || !strcmp(arg, "--version")) - print_version(EXIT_SUCCESS); + print_kill_version(); if (!strcmp(arg, "-h") || !strcmp(arg, "--help")) usage(); if (!strcmp(arg, "--verbose")) { @@ -319,6 +345,7 @@ static char **parse_arguments(int argc, char **argv, struct kill_control *ctl) arg = *argv; next = xcalloc(1, sizeof(*next)); next->period = strtos32_or_err(arg, _("argument error")); + INIT_LIST_HEAD(&next->follow_ups); argc--, argv++; arg = *argv; if ((next->sig = arg_to_signum(arg, 0)) < 0)