diff options
Diffstat (limited to 'launcher.c')
| -rwxr-xr-x | launcher.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -129,6 +129,7 @@ char **parse_argv(char *cmdline, int *argc) char *output = cmdline; char c; int nb = 0; + int iq = 0; *argc = 0; result[0] = output; @@ -136,19 +137,20 @@ char **parse_argv(char *cmdline, int *argc) do { c = *cmdline++; - if (!c || isspace(c)) { + if (!c || (isspace(c) && !iq)) { while (nb) {*output++ = '\\'; nb--; } *output++ = 0; result[++*argc] = output; if (!c) return result; while (isspace(*cmdline)) cmdline++; /* skip leading spaces */ + if (!*cmdline) return result; /* avoid empty arg if trailing ws */ continue; } if (c == '\\') ++nb; /* count \'s */ else { if (c == '"') { - if (!(nb & 1)) c = 0; /* skip " unless odd # of \ */ + if (!(nb & 1)) { iq = !iq; c = 0; } /* skip " unless odd # of \ */ nb = nb >> 1; /* cut \'s in half */ } while (nb) {*output++ = '\\'; nb--; } @@ -160,8 +162,6 @@ char **parse_argv(char *cmdline, int *argc) - - int run(int argc, char **argv, int is_gui) { char python[256]; /* python executable's filename*/ |
