diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-02-13 15:55:10 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-02-14 15:59:09 +0100 |
commit | 86beb21302082e9df0aa8576b89fd29c9e1a43be (patch) | |
tree | 3b2a7fce94d144978236b919fe12f311c383872b /src/systemctl/systemctl.c | |
parent | 76e5e267fcf4d5c8d1470769b97ad75a7c67394b (diff) | |
download | systemd-86beb21302082e9df0aa8576b89fd29c9e1a43be.tar.gz |
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.
Diffstat (limited to 'src/systemctl/systemctl.c')
-rw-r--r-- | src/systemctl/systemctl.c | 14 |
1 files changed, 4 insertions, 10 deletions
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: |