Skip to content

Commit 3a7b4c0

Browse files
committed
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
1 parent 82c551e commit 3a7b4c0

File tree

3 files changed

+30
-28
lines changed

3 files changed

+30
-28
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Thu Jun 5 16:21:16 2008 NAKAMURA Usaku <usa@ruby-lang.org>
2+
3+
* win32/win32.c (make_cmdvector): adjust escaped successive
4+
double-quote handling. (merge from trunk)
5+
16
Thu Jun 5 12:26:45 2008 NAKAMURA Usaku <usa@ruby-lang.org>
27

38
* win32/win32.c (init_env): initialize HOME and USER environment

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define RUBY_RELEASE_DATE "2008-06-05"
33
#define RUBY_VERSION_CODE 186
44
#define RUBY_RELEASE_CODE 20080605
5-
#define RUBY_PATCHLEVEL 127
5+
#define RUBY_PATCHLEVEL 128
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8

win32/win32.c

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,10 +1291,13 @@ rb_w32_cmdvector(const char *cmd, char ***vec)
12911291
if (!(slashes & 1)) {
12921292
if (!quote)
12931293
quote = *ptr;
1294-
else if (quote == *ptr)
1294+
else if (quote == *ptr) {
1295+
if (quote == '"' && quote == ptr[1])
1296+
ptr++;
12951297
quote = '\0';
1296-
escape++;
1298+
}
12971299
}
1300+
escape++;
12981301
slashes = 0;
12991302
break;
13001303

@@ -1321,44 +1324,38 @@ rb_w32_cmdvector(const char *cmd, char ***vec)
13211324
//
13221325

13231326
if (escape) {
1324-
char *p = base;
1327+
char *p = base, c;
13251328
slashes = quote = 0;
13261329
while (p < base + len) {
1327-
switch (*p) {
1330+
switch (c = *p) {
13281331
case '\\':
13291332
p++;
13301333
if (quote != '\'') slashes++;
13311334
break;
13321335

13331336
case '\'':
13341337
case '"':
1338+
if (!(slashes & 1) && quote && quote != c) {
1339+
p++;
1340+
slashes = 0;
1341+
break;
1342+
}
1343+
memcpy(p - ((slashes + 1) >> 1), p + (~slashes & 1),
1344+
base + len - p);
1345+
len -= ((slashes + 1) >> 1) + (~slashes & 1);
1346+
p -= (slashes + 1) >> 1;
13351347
if (!(slashes & 1)) {
1336-
if (!quote)
1337-
quote = *p;
1338-
else if (quote == *p)
1348+
if (quote) {
1349+
if (quote == '"' && quote == *p)
1350+
p++;
13391351
quote = '\0';
1340-
else {
1341-
p++;
1342-
slashes = 0;
1343-
break;
13441352
}
1353+
else
1354+
quote = c;
13451355
}
1346-
if (base + slashes == p) {
1347-
base += slashes >> 1;
1348-
len -= slashes >> 1;
1349-
slashes &= 1;
1350-
}
1351-
if (base == p) {
1352-
base = ++p;
1353-
--len;
1354-
}
1355-
else {
1356-
memcpy(p - ((slashes + 1) >> 1), p + (~slashes & 1), base + len - p);
1357-
slashes >>= 1;
1358-
p -= slashes;
1359-
len -= slashes + 1;
1360-
slashes = 0;
1361-
}
1356+
else
1357+
p++;
1358+
slashes = 0;
13621359
break;
13631360

13641361
default:

0 commit comments

Comments
 (0)