freerdp/freerdp-args.patch
2015-01-15 14:55:02 -07:00

185 lines
5.2 KiB
Diff

diff -up FreeRDP-1.2.0-beta1-android9/client/common/cmdline.c.args FreeRDP-1.2.0-beta1-android9/client/common/cmdline.c
--- FreeRDP-1.2.0-beta1-android9/client/common/cmdline.c.args 2015-01-15 14:38:15.573870682 -0700
+++ FreeRDP-1.2.0-beta1-android9/client/common/cmdline.c 2015-01-15 14:51:29.640391722 -0700
@@ -1087,8 +1087,10 @@ BOOL freerdp_client_detect_command_line(
*flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
*flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE;
- if (windows_cli_count >= posix_cli_count)
+ /* Check, if this may be windows style syntax... */
+ if (windows_cli_count && (windows_cli_count >= posix_cli_count) || (windows_cli_status <= COMMAND_LINE_STATUS_PRINT))
{
+ windows_cli_count = 1;
*flags = COMMAND_LINE_SEPARATOR_COLON;
*flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS;
}
diff -up FreeRDP-1.2.0-beta1-android9/client/common/compatibility.c.args FreeRDP-1.2.0-beta1-android9/client/common/compatibility.c
--- FreeRDP-1.2.0-beta1-android9/client/common/compatibility.c.args 2014-09-11 16:46:32.000000000 -0600
+++ FreeRDP-1.2.0-beta1-android9/client/common/compatibility.c 2015-01-15 14:53:19.418773129 -0700
@@ -119,16 +119,20 @@ void freerdp_client_old_parse_hostname(c
int freerdp_client_old_process_plugin(rdpSettings* settings, ADDIN_ARGV* args)
{
+ int args_handled = 0;
if (strcmp(args->argv[0], "cliprdr") == 0)
{
+ args_handled++;
settings->RedirectClipboard = TRUE;
DEBUG_WARN( "--plugin cliprdr -> +clipboard\n");
}
else if (strcmp(args->argv[0], "rdpdr") == 0)
{
+ args_handled++;
if (args->argc < 2)
- return -1;
+ return 1;
+ args_handled++;
if ((strcmp(args->argv[1], "disk") == 0) ||
(strcmp(args->argv[1], "drive") == 0))
{
@@ -156,21 +160,26 @@ int freerdp_client_old_process_plugin(rd
}
else if (strcmp(args->argv[0], "drdynvc") == 0)
{
+ args_handled++;
freerdp_client_add_dynamic_channel(settings, args->argc - 1, &args->argv[1]);
}
else if (strcmp(args->argv[0], "rdpsnd") == 0)
{
+ args_handled++;
if (args->argc < 2)
- return -1;
+ return 1;
+ args_handled++;
freerdp_addin_replace_argument_value(args, args->argv[1], "sys", args->argv[1]);
freerdp_client_add_static_channel(settings, args->argc, args->argv);
}
else if (strcmp(args->argv[0], "rail") == 0)
{
+ args_handled++;
if (args->argc < 2)
- return -1;
+ return 1;
+ args_handled++;
settings->RemoteApplicationProgram = _strdup(args->argv[1]);
}
else
@@ -178,14 +187,12 @@ int freerdp_client_old_process_plugin(rd
freerdp_client_add_static_channel(settings, args->argc, args->argv);
}
- return 1;
+ return args_handled;
}
int freerdp_client_old_command_line_pre_filter(void* context, int index, int argc, LPCSTR* argv)
{
- rdpSettings* settings;
-
- settings = (rdpSettings*) context;
+ rdpSettings* settings = (rdpSettings*) context;
if (index == (argc - 1))
{
@@ -201,11 +208,10 @@ int freerdp_client_old_command_line_pre_
return -1;
}
- if (settings)
- {
- freerdp_client_old_parse_hostname((char*) argv[index],
- &settings->ServerHostname, &settings->ServerPort);
- }
+ freerdp_client_old_parse_hostname((char*) argv[index],
+ &settings->ServerHostname, &settings->ServerPort);
+
+ return 2;
}
else
{
@@ -215,6 +221,7 @@ int freerdp_client_old_command_line_pre_
if (strcmp("--plugin", argv[index]) == 0)
{
+ int args_handled = 0;
int length;
char *a, *p;
int i, j, t;
@@ -230,20 +237,19 @@ int freerdp_client_old_command_line_pre_
return -1;
args = (ADDIN_ARGV*) malloc(sizeof(ADDIN_ARGV));
- args->argv = (char**) malloc(sizeof(char*) * 5);
+ args->argv = (char**) calloc(argc, sizeof(char*));
args->argc = 1;
- args->argv[0] = _strdup(argv[t]);
-
if ((index < argc - 1) && strcmp("--data", argv[index + 1]) == 0)
{
i = 0;
index += 2;
- args->argc = 1;
while ((index < argc) && (strcmp("--", argv[index]) != 0))
{
+ args_handled ++;
args->argc = 1;
+ args->argv[0] = _strdup(argv[t]);
for (j = 0, p = (char*) argv[index]; (j < 4) && (p != NULL); j++)
{
@@ -264,6 +270,9 @@ int freerdp_client_old_command_line_pre_
if (p != NULL)
{
p = strchr(p, ':');
+ }
+ if (p != NULL)
+ {
length = (int) (p - a);
args->argv[j + 1] = (char*) malloc(length + 1);
CopyMemory(args->argv[j + 1], a, length);
@@ -278,11 +287,14 @@ int freerdp_client_old_command_line_pre_
args->argc++;
}
- if (settings->instance)
+ if (settings)
{
freerdp_client_old_process_plugin(settings, args);
}
+ for (i = 0; i < args->argc; i++)
+ free(args->argv[i]);
+ memset(args->argv, 0, argc * sizeof(char*));
index++;
i++;
}
@@ -291,19 +303,16 @@ int freerdp_client_old_command_line_pre_
{
if (settings)
{
- if (settings->instance)
- {
- freerdp_client_old_process_plugin(settings, args);
- }
+ args->argv[0] = _strdup(argv[t]);
+ args_handled = freerdp_client_old_process_plugin(settings, args);
+ free (args->argv[0]);
}
}
- for (i = 0; i < args->argc; i++)
- free(args->argv[i]);
free(args->argv);
free(args);
- return (index - old_index);
+ return (index - old_index) + args_handled;
}
return 0;