summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-05 07:21:20 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-05 07:21:20 +0000
commit3a7b4c03636858e9b8b84a8771252006dcc53881 (patch)
tree04e81875714aa605cfce739214bcbd8506fb94ac
parent82c551e974b58489f82268bda749939dc40b0c65 (diff)
merge revision(s) 13602:
* win32/win32.c (make_cmdvector): adjust escaped successive double-quote handling. (merge from trunk) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@16838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--version.h2
-rw-r--r--win32/win32.c51
3 files changed, 30 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 3431cb2..6709d0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 5 16:21:16 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (make_cmdvector): adjust escaped successive
+ double-quote handling. (merge from trunk)
+
Thu Jun 5 12:26:45 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (init_env): initialize HOME and USER environment
diff --git a/version.h b/version.h
index 4bea353..d70a977 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2008-06-05"
#define RUBY_VERSION_CODE 186
#define RUBY_RELEASE_CODE 20080605
-#define RUBY_PATCHLEVEL 127
+#define RUBY_PATCHLEVEL 128
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
diff --git a/win32/win32.c b/win32/win32.c
index aa46011..3c16e57 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1291,10 +1291,13 @@ rb_w32_cmdvector(const char *cmd, char ***vec)
if (!(slashes & 1)) {
if (!quote)
quote = *ptr;
- else if (quote == *ptr)
+ else if (quote == *ptr) {
+ if (quote == '"' && quote == ptr[1])
+ ptr++;
quote = '\0';
- escape++;
+ }
}
+ escape++;
slashes = 0;
break;
@@ -1321,10 +1324,10 @@ rb_w32_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++;
if (quote != '\'') slashes++;
@@ -1332,33 +1335,27 @@ rb_w32_cmdvector(const char *cmd, char ***vec)
case '\'':
case '"':
+ if (!(slashes & 1) && quote && quote != c) {
+ p++;
+ slashes = 0;
+ break;
+ }
+ memcpy(p - ((slashes + 1) >> 1), p + (~slashes & 1),
+ base + len - p);
+ len -= ((slashes + 1) >> 1) + (~slashes & 1);
+ p -= (slashes + 1) >> 1;
if (!(slashes & 1)) {
- if (!quote)
- quote = *p;
- else if (quote == *p)
+ if (quote) {
+ if (quote == '"' && quote == *p)
+ p++;
quote = '\0';
- else {
- p++;
- slashes = 0;
- break;
}
+ else
+ quote = c;
}
- if (base + slashes == p) {
- base += slashes >> 1;
- len -= slashes >> 1;
- slashes &= 1;
- }
- if (base == p) {
- base = ++p;
- --len;
- }
- else {
- memcpy(p - ((slashes + 1) >> 1), p + (~slashes & 1), base + len - p);
- slashes >>= 1;
- p -= slashes;
- len -= slashes + 1;
- slashes = 0;
- }
+ else
+ p++;
+ slashes = 0;
break;
default: