diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/popen.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/popen.c b/plugins/popen.c index 80a7119..a7e6f9b 100644 --- a/plugins/popen.c +++ b/plugins/popen.c | |||
@@ -104,7 +104,7 @@ spopen (const char *cmdstring) | |||
104 | char *env[2]; | 104 | char *env[2]; |
105 | char *cmd = NULL; | 105 | char *cmd = NULL; |
106 | char **argv = NULL; | 106 | char **argv = NULL; |
107 | char *str; | 107 | char *str, *tmp; |
108 | int argc; | 108 | int argc; |
109 | 109 | ||
110 | int i = 0, pfd[2], pfderr[2]; | 110 | int i = 0, pfd[2], pfderr[2]; |
@@ -166,7 +166,15 @@ spopen (const char *cmdstring) | |||
166 | cmd = 1 + strstr (str, "'"); | 166 | cmd = 1 + strstr (str, "'"); |
167 | str[strcspn (str, "'")] = 0; | 167 | str[strcspn (str, "'")] = 0; |
168 | } | 168 | } |
169 | else { | 169 | else if (strcspn(str,"'") < strcspn (str, " \t\r\n")) { |
170 | /* handle --option='foo bar' strings */ | ||
171 | tmp = str + strcspn(str, "'") + 1; | ||
172 | if (!strstr (tmp, "'")) | ||
173 | return NULL; /* balanced? */ | ||
174 | tmp += strcspn(tmp,"'") + 1; | ||
175 | *tmp = 0; | ||
176 | cmd = tmp + 1; | ||
177 | } else { | ||
170 | if (strpbrk (str, " \t\r\n")) { | 178 | if (strpbrk (str, " \t\r\n")) { |
171 | cmd = 1 + strpbrk (str, " \t\r\n"); | 179 | cmd = 1 + strpbrk (str, " \t\r\n"); |
172 | str[strcspn (str, " \t\r\n")] = 0; | 180 | str[strcspn (str, " \t\r\n")] = 0; |
@@ -180,6 +188,7 @@ spopen (const char *cmdstring) | |||
180 | cmd = NULL; | 188 | cmd = NULL; |
181 | 189 | ||
182 | argv[i++] = str; | 190 | argv[i++] = str; |
191 | printf("arg no.%i: %s\n",i,str); | ||
183 | 192 | ||
184 | } | 193 | } |
185 | argv[i] = NULL; | 194 | argv[i] = NULL; |