diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-26 03:15:08 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-26 03:15:08 +0000 |
| commit | 34b6097ff4df839b01da8aea7ea9403b693152c0 (patch) | |
| tree | c8964eac056067cf8ce12d3094a5ab8fd8354162 /win32 | |
| parent | 09b1426692203abaa7e1d405d990ebad546c7e8e (diff) | |
| download | ruby-34b6097ff4df839b01da8aea7ea9403b693152c0.tar.gz ruby-34b6097ff4df839b01da8aea7ea9403b693152c0.tar.xz ruby-34b6097ff4df839b01da8aea7ea9403b693152c0.zip | |
* win32/win32.c (make_cmdvector): adjust successive double-quote
handling.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/win32.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/win32/win32.c b/win32/win32.c index 54164322f..5a346fe1c 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; |
