};
DEFINE_STRING_TABLE_LOOKUP(runtime_scope, RuntimeScope);
+
+static const char* const runtime_scope_cmdline_option_table[_RUNTIME_SCOPE_MAX] = {
+ [RUNTIME_SCOPE_SYSTEM] = "--system",
+ [RUNTIME_SCOPE_USER] = "--user",
+ [RUNTIME_SCOPE_GLOBAL] = "--global",
+};
+
+DEFINE_STRING_TABLE_LOOKUP_TO_STRING(runtime_scope_cmdline_option, RuntimeScope);
const char *runtime_scope_to_string(RuntimeScope scope) _const_;
RuntimeScope runtime_scope_from_string(const char *s) _const_;
+
+const char *runtime_scope_cmdline_option_to_string(RuntimeScope scope) _const_;
if (switch_root_dir)
args[i++] = "--switched-root";
- args[i++] = arg_runtime_scope == RUNTIME_SCOPE_SYSTEM ? "--system" : "--user";
+ args[i++] = runtime_scope_cmdline_option_to_string(arg_runtime_scope);
args[i++] = "--deserialize";
args[i++] = sfd;
args[i++] = NULL;
if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Bad action for %s mode.",
- arg_runtime_scope == RUNTIME_SCOPE_GLOBAL ? "--global" : "--user");
+ runtime_scope_cmdline_option_to_string(arg_runtime_scope));
return verb_start_special(argc, argv, userdata);
}