2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

parser: unify flagtable printing for warn, dump and optimize

warn, dump, and optize share common printing of their option flag
tables, refactor and unify.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/600
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen
2020-09-01 00:52:57 -07:00
parent 3d54324db0
commit db07b131b5
3 changed files with 15 additions and 32 deletions

View File

@@ -147,24 +147,14 @@ int handle_flag_table(optflag_table_t *table, const char *optarg,
return 0;
}
void display_dump(const char *command)
void flagtable_help(const char *name, const char *header, const char *command,
optflag_table_t *table)
{
display_version();
printf("\n%s: --dump [Option]\n\n"
printf("\n%s: --%s [Option]\n\n"
"%s"
"Options:\n"
"--------\n"
" variables \tDump variables\n"
" expanded-variables\t Dump variables after expansion\n"
,command);
print_flag_table(dumpflag_table);
}
void display_optimize(const char *command)
{
display_version();
printf("\n%s: -O [Option]\n\n"
"Options:\n"
"--------\n"
,command);
print_flag_table(optflag_table);
,name, command, header);
print_flag_table(table);
}