diff --git a/plugins/popen.c b/plugins/popen.c
index 80a7119b983cc711452a3524f77417e1434c8b58..a7e6f9b2f238c202297c95256f5287f530e47059 100644 (file)
--- a/plugins/popen.c
+++ b/plugins/popen.c
char *env[2];
char *cmd = NULL;
char **argv = NULL;
- char *str;
+ char *str, *tmp;
int argc;
int i = 0, pfd[2], pfderr[2];
cmd = 1 + strstr (str, "'");
str[strcspn (str, "'")] = 0;
}
- else {
+ else if (strcspn(str,"'") < strcspn (str, " \t\r\n")) {
+ /* handle --option='foo bar' strings */
+ tmp = str + strcspn(str, "'") + 1;
+ if (!strstr (tmp, "'"))
+ return NULL; /* balanced? */
+ tmp += strcspn(tmp,"'") + 1;
+ *tmp = 0;
+ cmd = tmp + 1;
+ } else {
if (strpbrk (str, " \t\r\n")) {
cmd = 1 + strpbrk (str, " \t\r\n");
str[strcspn (str, " \t\r\n")] = 0;
cmd = NULL;
argv[i++] = str;
+ printf("arg no.%i: %s\n",i,str);
}
argv[i] = NULL;