summaryrefslogtreecommitdiff
path: root/src/machine/machinectl.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-04-24 11:31:19 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-04-27 09:05:42 -0400
commit0bf50960493787a76d542356a93bb22f22af8072 (patch)
tree8f249586631d30a33305a17f09378c3dc6802b1a /src/machine/machinectl.c
parent3136ec90adf6d797eb2ac756f52313581124f38e (diff)
machinectl: simplify option string assignment
It's better to avoid having the option string duplicated, lest we forget to modify them in sync in the future.
Diffstat (limited to 'src/machine/machinectl.c')
-rw-r--r--src/machine/machinectl.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index b03198bbf1..5a68c4ceb2 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -2516,14 +2516,9 @@ static int parse_argv(int argc, char *argv[]) {
assert(argv);
for (;;) {
- const char *option_string;
+ const char * const option_string = "+hp:als:H:M:qn:o:";
- if (reorder)
- option_string = "hp:als:H:M:qn:o:";
- else
- option_string = "+hp:als:H:M:qn:o:";
-
- c = getopt_long(argc, argv, option_string, options, NULL);
+ c = getopt_long(argc, argv, option_string + reorder, options, NULL);
if (c < 0) {
/* We generally are fine with the fact that getopt_long() reorders the command line, and looks
* for switches after the main verb. However, for "shell" we really don't want that, since we