kov changed libgksu/trunk/ChangeLog,
libgksu/trunk/libgksu/gksu-context.c
Gustavo Noronha
kov at costa.debian.org
Tue Sep 13 02:26:00 UTC 2005
Mensagem de log:
* libgksu/gksu-context.c:
- treat the command line to remove the quotes that may have
been added by gksu's multi-argument processing code
-----
Modified: libgksu/trunk/ChangeLog
===================================================================
--- libgksu/trunk/ChangeLog 2005-09-13 01:39:19 UTC (rev 434)
+++ libgksu/trunk/ChangeLog 2005-09-13 02:26:00 UTC (rev 435)
@@ -1,3 +1,9 @@
+2005-09-12 Gustavo Noronha Silva <kov at debian.org>
+
+ * libgksu/gksu-context.c:
+ - treat the command line to remove the quotes that may have
+ been added by gksu's multi-argument processing code
+
2005-08-20 Gustavo Noronha Silva <kov at debian.org>
* libgksu/gksu-context.{c,h}:
Modified: libgksu/trunk/libgksu/gksu-context.c
===================================================================
--- libgksu/trunk/libgksu/gksu-context.c 2005-09-13 01:39:19 UTC (rev 434)
+++ libgksu/trunk/libgksu/gksu-context.c 2005-09-13 02:26:00 UTC (rev 435)
@@ -1264,28 +1264,49 @@
argcount++;
}
- for (i = j = 0; ; i++)
- {
- if (context->command[i] == ' ' || context->command[i] == '\0')
- {
- buffer[j] = '\0';
- cmd = g_realloc (cmd, sizeof(gchar*) * (argcount + 1));
- cmd[argcount] = g_strdup (buffer);
- bzero (buffer, 256);
- argcount = argcount + 1;
- j = 0;
+ {
+ gchar *tmp_arg = g_malloc (sizeof(gchar)*1);
+ gboolean inside_quotes = FALSE;
- if (context->command[i] == '\0')
- break;
- }
- else
- {
- if (context->command[i] == '\\')
+ tmp_arg[0] = '\0';
+
+ for (i = j = 0; ; i++)
+ {
+ if ((context->command[i] == '\'') && (context->command[i-1] != '\\'))
+ {
i = i + 1;
- buffer[j] = context->command[i];
- j = j + 1;
- }
- }
+ inside_quotes = !inside_quotes;
+ }
+
+ if ((context->command[i] == ' ' && inside_quotes == FALSE)
+ || context->command[i] == '\0')
+ {
+ tmp_arg = g_realloc (tmp_arg, sizeof(gchar)*(j+1));
+ tmp_arg[j] = '\0';
+ cmd = g_realloc (cmd, sizeof(gchar*) * (argcount + 1));
+ cmd[argcount] = g_strdup (tmp_arg);
+
+ g_free (tmp_arg);
+
+ argcount = argcount + 1;
+ j = 0;
+
+ if (context->command[i] == '\0')
+ break;
+
+ tmp_arg = g_malloc (sizeof(gchar)*1);
+ tmp_arg[0] = '\0';
+ }
+ else
+ {
+ if (context->command[i] == '\\')
+ i = i + 1;
+ tmp_arg = g_realloc (tmp_arg, sizeof(gchar)*(j+1));
+ tmp_arg[j] = context->command[i];
+ j = j + 1;
+ }
+ }
+ }
cmd = g_realloc (cmd, sizeof(gchar*) * (argcount + 1));
cmd[argcount] = NULL;
More information about the gksu-commits
mailing list