[client,cmdline] add options for /list:

* /list:smartcard now allows /list:smartcard:<optional> to use different
  pkcs11 modules and settings
* /list:kbd-lang now allows /list:kbd-lang:LANG_* to filter languages
This commit is contained in:
Armin Novak 2023-06-08 09:39:01 +02:00 committed by akallabeth
parent 06fd58264e
commit 49eaf78515
2 changed files with 52 additions and 4 deletions

View File

@ -1540,19 +1540,64 @@ int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings,
freerdp_client_print_tune_list(settings);
else if (option_equals("kbd", arg->Value))
freerdp_client_print_keyboard_list();
else if (option_equals("kbd-lang", arg->Value))
else if (option_starts_with("kbd-lang", arg->Value))
{
const char* val = NULL;
if (option_starts_with("kbd-lang:", arg->Value))
val = &arg->Value[9];
else if (!option_equals("kbd-lang", arg->Value))
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
else if (strchr(val, ','))
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
freerdp_client_print_codepages(val);
}
else if (option_equals("kbd-scancode", arg->Value))
freerdp_client_print_scancodes();
else if (option_equals("monitor", arg->Value))
settings->ListMonitors = TRUE;
else if (option_equals("smartcard", arg->Value))
else if (option_starts_with("smartcard", arg->Value))
{
BOOL opts = FALSE;
if (option_starts_with("smartcard:", arg->Value))
opts = TRUE;
else if (!option_equals("smartcard", arg->Value))
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
if (opts)
{
const char* sub = strchr(arg->Value, ':') + 1;
const CmdLineSubOptions options[] = {
{ "pkinit-anchors:", FreeRDP_PkinitAnchors, CMDLINE_SUBOPTION_STRING,
NULL },
{ "pkcs11-module:", FreeRDP_Pkcs11Module, CMDLINE_SUBOPTION_STRING, NULL }
};
size_t count = 0;
char** ptr = CommandLineParseCommaSeparatedValuesEx("smartcard", sub, &count);
if (!ptr)
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
if (count < 2)
{
free(ptr);
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
}
for (size_t x = 1; x < count; x++)
{
const char* cur = ptr[x];
if (!parseSubOptions(settings, options, ARRAYSIZE(options), cur))
{
free(ptr);
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
}
}
free(ptr);
}
freerdp_smartcard_list(settings);
}
else
{
freerdp_client_print_command_line_help_ex(argc, argv, custom);

View File

@ -287,8 +287,11 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = {
{ "load-balance-info", COMMAND_LINE_VALUE_REQUIRED, "<info-string>", NULL, NULL, -1, NULL,
"Load balance info" },
{ "list", COMMAND_LINE_VALUE_REQUIRED | COMMAND_LINE_PRINT,
"[kbd|kbd-scancode|kbd-lang|smartcard|monitor|tune]", "List available options for subcommand",
NULL, -1, NULL, "List available options for subcommand" },
"[kbd|kbd-scancode|kbd-lang[:<value>]|smartcard[:[pkinit-anchors:<path>][,pkcs11-module:<"
"name>]]|"
"monitor|tune]",
"List available options for subcommand", NULL, -1, NULL,
"List available options for subcommand" },
{ "log-filters", COMMAND_LINE_VALUE_REQUIRED, "<tag>:<level>[,<tag>:<level>[,...]]", NULL, NULL,
-1, NULL, "Set logger filters, see wLog(7) for details" },
{ "log-level", COMMAND_LINE_VALUE_REQUIRED, "[OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE]", NULL,