mirror of https://github.com/FreeRDP/FreeRDP
Added a new flag to indicate the presence of a single not escaped argument
allowing the legacy command line <server>:<port> syntax.
This commit is contained in:
parent
a7a7bab619
commit
21127ec33b
|
@ -302,6 +302,7 @@ int freerdp_detect_old_command_line_syntax(int argc, char** argv, int* count)
|
|||
detect_status = 0;
|
||||
flags = COMMAND_LINE_SEPARATOR_SPACE;
|
||||
flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
|
||||
flags |= COMMAND_LINE_SIGIL_NOT_ESCAPED;
|
||||
|
||||
settings = (rdpSettings*) malloc(sizeof(rdpSettings));
|
||||
ZeroMemory(settings, sizeof(rdpSettings));
|
||||
|
@ -372,6 +373,7 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe
|
|||
flags = COMMAND_LINE_SEPARATOR_SPACE;
|
||||
flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
|
||||
flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE;
|
||||
flags |= COMMAND_LINE_SIGIL_NOT_ESCAPED;
|
||||
|
||||
status = CommandLineParseArgumentsA(argc, (const char**) argv, old_args, flags, settings,
|
||||
freerdp_client_old_command_line_pre_filter, freerdp_client_old_command_line_post_filter);
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#define COMMAND_LINE_SIGIL_DOUBLE_DASH 0x00000008
|
||||
#define COMMAND_LINE_SIGIL_PLUS_MINUS 0x00000010
|
||||
#define COMMAND_LINE_SIGIL_ENABLE_DISABLE 0x00000020
|
||||
#define COMMAND_LINE_SIGIL_NOT_ESCAPED 0x00000040
|
||||
|
||||
#define COMMAND_LINE_SEPARATOR_COLON 0x00000100
|
||||
#define COMMAND_LINE_SEPARATOR_EQUAL 0x00000200
|
||||
|
|
|
@ -54,6 +54,7 @@ int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A*
|
|||
int length;
|
||||
int index;
|
||||
BOOL match, found, argument = FALSE;
|
||||
BOOL notescaped = FALSE;
|
||||
char* sigil;
|
||||
int sigil_length;
|
||||
int sigil_index;
|
||||
|
@ -81,6 +82,7 @@ int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A*
|
|||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
BOOL escaped = TRUE;
|
||||
index = i;
|
||||
|
||||
if (preFilter)
|
||||
|
@ -130,12 +132,21 @@ int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A*
|
|||
{
|
||||
sigil_length = 0;
|
||||
}
|
||||
else if (flags & COMMAND_LINE_SIGIL_NOT_ESCAPED)
|
||||
{
|
||||
if (notescaped)
|
||||
return COMMAND_LINE_ERROR;
|
||||
sigil_length = 0;
|
||||
escaped = FALSE;
|
||||
notescaped = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return COMMAND_LINE_ERROR;
|
||||
}
|
||||
|
||||
if ((sigil_length > 0) || (flags & COMMAND_LINE_SIGIL_NONE))
|
||||
if ((sigil_length > 0) || (flags & COMMAND_LINE_SIGIL_NONE) ||
|
||||
(flags & COMMAND_LINE_SIGIL_NOT_ESCAPED))
|
||||
{
|
||||
if (length < (sigil_length + 1))
|
||||
return COMMAND_LINE_ERROR_NO_KEYWORD;
|
||||
|
@ -191,6 +202,9 @@ int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A*
|
|||
value_length = 0;
|
||||
}
|
||||
|
||||
if (!escaped)
|
||||
continue;
|
||||
|
||||
found = FALSE;
|
||||
for (j = 0; options[j].Name != NULL; j++)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue