Convert loginctl to option and verb macros (#42066)

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-05-13 11:22:12 +02:00
committed by GitHub
4 changed files with 420 additions and 461 deletions
+1 -1
View File
@@ -227,7 +227,7 @@ static int help(void) {
if (r < 0)
return r;
assert_se(ELEMENTSOF(vtables) == 9);
assert_cc(ELEMENTSOF(vtables) == 9);
(void) table_sync_column_widths(0, options, vtables[0], vtables[1], vtables[2],
vtables[3], vtables[4], vtables[5], vtables[6],
vtables[7], vtables[8]);
+1 -1
View File
@@ -251,7 +251,7 @@ static int help(void) {
return r;
}
assert_se(ELEMENTSOF(tables) == 6);
assert_cc(ELEMENTSOF(tables) == 6);
(void) table_sync_column_widths(0, tables[0], tables[1], tables[2],
tables[3], tables[4], tables[5]);
+416 -457
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -83,7 +83,6 @@ int _dispatch_verb_with_args(char **args, const Verb verbs[], const Verb verbs_e
assert(verbs);
assert(verbs_end > verbs);
assert(verbs[0].dispatch);
assert(verbs[0].verb);
const char *name = args ? args[0] : NULL;
@@ -101,6 +100,7 @@ int _dispatch_verb_with_args(char **args, const Verb verbs[], const Verb verbs_e
if (r < 0)
return log_oom();
}
assert(!strv_isempty(verb_strv)); /* At least one verb should be defined… */
if (name) {
/* Be more helpful to the user, and give a hint what the user might have wanted to type. */
@@ -121,7 +121,7 @@ int _dispatch_verb_with_args(char **args, const Verb verbs[], const Verb verbs_e
"Command verb required (one of %s).", joined);
}
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Command verb '%s' required.", verbs[0].verb);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Command verb '%s' required.", verb_strv[0]);
}
if (!name)