1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* win32/win32.c (make_cmdvector): adjust successive double-quote

handling.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2004-02-26 03:15:08 +00:00
parent 1eafe8b157
commit 0ff6bcae35
2 changed files with 17 additions and 6 deletions

View file

@ -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

View file

@ -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;