diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | win32/win32.c | 18 |
2 files changed, 17 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Thu Feb 26 12:15:02 2004 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * win32/win32.c (make_cmdvector): adjust successive double-quote + handling. + Thu Feb 26 02:35:10 2004 Nobuyoshi Nakada <nobu@ruby-lang.org> * process.c (rb_f_exec): get rid of SEGV when exec failed for command diff --git a/win32/win32.c b/win32/win32.c index 54164322f3..5a346fe1c0 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1167,8 +1167,10 @@ make_cmdvector(const char *cmd, char ***vec) if (!(slashes & 1)) { if (!quote) quote = *ptr; - else if (quote == *ptr) + else if (quote == *ptr) { + if (quote == '"' && ptr[1] == '"') ptr++; quote = '\0'; + } escape++; } slashes = 0; @@ -1197,10 +1199,10 @@ make_cmdvector(const char *cmd, char ***vec) // if (escape) { - char *p = base; + char *p = base, c; slashes = quote = 0; while (p < base + len) { - switch (*p) { + switch (c = *p) { case '\\': p++; slashes++; @@ -1209,10 +1211,13 @@ make_cmdvector(const char *cmd, char ***vec) case '\'': case '"': if (!(slashes & 1)) { - if (!quote) - quote = *p; - else if (quote == *p) + if (!quote) { + quote = c; + c = '\0'; + } + else if (quote == c) { quote = '\0'; + } else { p++; slashes = 0; @@ -1234,6 +1239,7 @@ make_cmdvector(const char *cmd, char ***vec) p -= slashes; len -= slashes + 1; slashes = 0; + if (c == '"' && *p == c) p++; } break; |