summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-05 07:20:04 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-05 07:20:04 +0000
commitddf5c0d8c706469bc6b1fbfd1aceebab8fca1ad8 (patch)
tree1d2f158f1f9f81a9252cbfb7e16783d0ffea6c50
parente6717679c09420842d7450dd60a55751e231e8d9 (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_5@16836 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 12deb418df..c4cc641dd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 5 16:19:27 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:24:25 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 34628dcd8b..614fe1fc16 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2008-06-05"
#define RUBY_VERSION_CODE 185
#define RUBY_RELEASE_CODE 20080605
-#define RUBY_PATCHLEVEL 128
+#define RUBY_PATCHLEVEL 129
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
diff --git a/win32/win32.c b/win32/win32.c
index 3fae1e594c..f9c1af57aa 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1313,10 +1313,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;
@@ -1343,10 +1346,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++;
@@ -1354,33 +1357,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: