Add new argument type CRYPT_ARG_ALIAS.

It can be used to easily define option
aliases for command line utilities.
This commit is contained in:
Ondrej Kozina
2022-03-29 12:51:53 +02:00
parent e4ed545cbf
commit e2a5af9e64
4 changed files with 28 additions and 1 deletions

View File

@@ -3105,6 +3105,15 @@ static void basic_options_cb(poptContext popt_context,
}
}
static void cryptsetup_init_arg_aliases(void)
{
unsigned i;
for (i = 1; i < ARRAY_SIZE(tool_core_args); i++)
if (tool_core_args[i].type == CRYPT_ARG_ALIAS)
ARG_INIT_ALIAS(i);
}
int main(int argc, const char **argv)
{
static struct poptOption popt_help_options[] = {
@@ -3131,6 +3140,9 @@ int main(int argc, const char **argv)
const char *aname, *error_message;
int r;
/* initialize aliases */
cryptsetup_init_arg_aliases();
crypt_set_log_callback(NULL, tool_log, &log_parms);
setlocale(LC_ALL, "");