From 86beb21302082e9df0aa8576b89fd29c9e1a43be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 13 Feb 2021 15:55:10 +0100 Subject: systemctl,loginctl,machinectl: use a shared helper for arg_signal I seems frivolous to yet another two -util.[ch] files, but the helper should be in shared/ and it doesn't seem to fit anywhere else. --- src/systemctl/systemctl.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/systemctl/systemctl.c') diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 97a02ff035..0371ff355e 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -11,6 +11,7 @@ #include "main-func.h" #include "output-mode.h" #include "pager.h" +#include "parse-argument.h" #include "path-util.h" #include "pretty-print.h" #include "rlimit-util.h" @@ -673,16 +674,9 @@ static int systemctl_parse_argv(int argc, char *argv[]) { break; case 's': - if (streq(optarg, "help")) { - DUMP_STRING_TABLE(signal, int, _NSIG); - return 0; - } - - arg_signal = signal_from_string(optarg); - if (arg_signal < 0) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "Failed to parse signal string %s.", - optarg); + r = parse_signal_argument(optarg, &arg_signal); + if (r <= 0) + return r; break; case ARG_NO_ASK_PASSWORD: -- cgit v1.2.1