mirror of https://github.com/FreeRDP/FreeRDP
Improved command line help printing
This commit is contained in:
parent
e36c49eab7
commit
7b65677b65
|
@ -301,8 +301,19 @@ static void freerdp_client_print_scancodes(void)
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL is_delimiter(const char* delimiters, char c)
|
||||
{
|
||||
char d;
|
||||
while ((d = *delimiters++) != '\0')
|
||||
{
|
||||
if (d == c)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static char* print_token(char* text, size_t start_offset, size_t* current, size_t limit,
|
||||
const char delimiter)
|
||||
const char* delimiters)
|
||||
{
|
||||
int rc;
|
||||
size_t len = strlen(text);
|
||||
|
@ -321,7 +332,7 @@ static char* print_token(char* text, size_t start_offset, size_t* current, size_
|
|||
|
||||
for (x = MIN(len, limit - start_offset); x > 1; x--)
|
||||
{
|
||||
if (text[x] == delimiter)
|
||||
if (is_delimiter(delimiters, text[x]))
|
||||
{
|
||||
printf("%.*s\n", (int)x, text);
|
||||
*current = 0;
|
||||
|
@ -343,10 +354,13 @@ static size_t print_optionals(const char* text, size_t start_offset, size_t curr
|
|||
{
|
||||
const size_t limit = 80;
|
||||
char* str = _strdup(text);
|
||||
char* cur = print_token(str, start_offset, ¤t, limit, '[');
|
||||
char* cur = print_token(str, start_offset, ¤t, limit, "[], ");
|
||||
|
||||
while (cur)
|
||||
cur = print_token(cur, start_offset, ¤t, limit, '[');
|
||||
{
|
||||
cur++;
|
||||
cur = print_token(cur, start_offset + 1, ¤t, limit, "[], ");
|
||||
}
|
||||
|
||||
free(str);
|
||||
return current;
|
||||
|
@ -356,12 +370,12 @@ static size_t print_description(const char* text, size_t start_offset, size_t cu
|
|||
{
|
||||
const size_t limit = 80;
|
||||
char* str = _strdup(text);
|
||||
char* cur = print_token(str, start_offset, ¤t, limit, ' ');
|
||||
char* cur = print_token(str, start_offset, ¤t, limit, " ");
|
||||
|
||||
while (cur)
|
||||
{
|
||||
cur++;
|
||||
cur = print_token(cur, start_offset, ¤t, limit, ' ');
|
||||
cur = print_token(cur, start_offset, ¤t, limit, " ");
|
||||
}
|
||||
|
||||
free(str);
|
||||
|
@ -446,7 +460,7 @@ BOOL freerdp_client_print_command_line_help(int argc, char** argv)
|
|||
}
|
||||
|
||||
BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv,
|
||||
COMMAND_LINE_ARGUMENT_A* custom)
|
||||
const COMMAND_LINE_ARGUMENT_A* custom)
|
||||
{
|
||||
const char* name = "FreeRDP";
|
||||
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(global_cmd_args)];
|
||||
|
@ -1289,7 +1303,7 @@ int freerdp_client_settings_command_line_status_print(rdpSettings* settings, int
|
|||
|
||||
int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings, int status,
|
||||
int argc, char** argv,
|
||||
COMMAND_LINE_ARGUMENT_A* custom)
|
||||
const COMMAND_LINE_ARGUMENT_A* custom)
|
||||
{
|
||||
const COMMAND_LINE_ARGUMENT_A* arg;
|
||||
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(global_cmd_args)];
|
||||
|
|
|
@ -140,7 +140,7 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = {
|
|||
"fast-path input/output" },
|
||||
{ "fipsmode", COMMAND_LINE_VALUE_BOOL, NULL, NULL, NULL, -1, NULL, "FIPS mode" },
|
||||
{ "floatbar", COMMAND_LINE_VALUE_OPTIONAL,
|
||||
"sticky:[on|off],default:[visible|hidden],show:[always|fullscreen||window]", NULL, NULL, -1,
|
||||
"sticky:[on|off],default:[visible|hidden],show:[always|fullscreen|window]", NULL, NULL, -1,
|
||||
NULL,
|
||||
"floatbar is disabled by default (when enabled defaults to sticky in fullscreen mode)" },
|
||||
{ "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
|
||||
|
@ -225,7 +225,8 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = {
|
|||
"Send unicode symbols, e.g. use the local keyboard map. ATTENTION: Does not work with every "
|
||||
"RDP server!" },
|
||||
{ "kerberos", COMMAND_LINE_VALUE_REQUIRED,
|
||||
"[lifetime:<time>,start-time:<time>,renewable-lifetime:<time>,cache:<path>,armor:<path>,pkinit-anchors:<path>,pkcs11-module:<name>]",
|
||||
"[lifetime:<time>,start-time:<time>,renewable-lifetime:<time>,cache:<path>,armor:<path>,"
|
||||
"pkinit-anchors:<path>,pkcs11-module:<name>]",
|
||||
NULL, NULL, -1, NULL, "Kerberos options" },
|
||||
{ "load-balance-info", COMMAND_LINE_VALUE_REQUIRED, "<info-string>", NULL, NULL, -1, NULL,
|
||||
"Load balance info" },
|
||||
|
@ -343,8 +344,9 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = {
|
|||
"Scale remote desktop to window size" },
|
||||
{ "smartcard", COMMAND_LINE_VALUE_OPTIONAL, "<str>[,<str>...]", NULL, NULL, -1, NULL,
|
||||
"Redirect the smartcard devices containing any of the <str> in their names." },
|
||||
{ "smartcard-logon", COMMAND_LINE_VALUE_OPTIONAL, "[cert:<path>,key:<key>,pin:<pin>,csp:<csp name>,reader:<reader>,card:<card>]", NULL,
|
||||
NULL, -1, NULL, "Activates Smartcard (optional certificate) Logon authentication." },
|
||||
{ "smartcard-logon", COMMAND_LINE_VALUE_OPTIONAL,
|
||||
"[cert:<path>,key:<key>,pin:<pin>,csp:<csp name>,reader:<reader>,card:<card>]", NULL, NULL,
|
||||
-1, NULL, "Activates Smartcard (optional certificate) Logon authentication." },
|
||||
{ "sound", COMMAND_LINE_VALUE_OPTIONAL,
|
||||
"[sys:<sys>,][dev:<dev>,][format:<format>,][rate:<rate>,][channel:<channel>,][latency:<"
|
||||
"latency>,][quality:<quality>]",
|
||||
|
|
|
@ -36,15 +36,17 @@ extern "C"
|
|||
FREERDP_API int freerdp_client_settings_command_line_status_print(rdpSettings* settings,
|
||||
int status, int argc,
|
||||
char** argv);
|
||||
FREERDP_API int freerdp_client_settings_command_line_status_print_ex(
|
||||
rdpSettings* settings, int status, int argc, char** argv, COMMAND_LINE_ARGUMENT_A* custom);
|
||||
FREERDP_API int
|
||||
freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings, int status,
|
||||
int argc, char** argv,
|
||||
const COMMAND_LINE_ARGUMENT_A* custom);
|
||||
FREERDP_API BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings);
|
||||
|
||||
FREERDP_API BOOL freerdp_client_print_version(void);
|
||||
FREERDP_API BOOL freerdp_client_print_buildconfig(void);
|
||||
FREERDP_API BOOL freerdp_client_print_command_line_help(int argc, char** argv);
|
||||
FREERDP_API BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv,
|
||||
COMMAND_LINE_ARGUMENT_A* custom);
|
||||
FREERDP_API BOOL freerdp_client_print_command_line_help_ex(
|
||||
int argc, char** argv, const COMMAND_LINE_ARGUMENT_A* custom);
|
||||
|
||||
FREERDP_API BOOL freerdp_parse_username(const char* username, char** user, char** domain);
|
||||
FREERDP_API BOOL freerdp_parse_hostname(const char* hostname, char** host, int* port);
|
||||
|
|
Loading…
Reference in New Issue