cmd: Fix redirection handle parsing.

This commit is contained in:
Frédéric Delanoy 2011-08-27 02:11:30 +02:00 committed by Alexandre Julliard
parent 523683d788
commit bbdaed2f33
3 changed files with 29 additions and 16 deletions

View File

@ -81,6 +81,12 @@ echo foo>foo
type foo
echo foo 1> foo
type foo
echo foo@tab@1> foo
type foo
echo foo 1>@tab@foo
type foo
echo foo@tab@1>@tab@foo
type foo
echo foo7 7> foo
type foo
echo foo9 9> foo
@ -91,6 +97,9 @@ echo foo11> foo
type foo
echo foo12> foo
type foo
del foo
echo1>foo
type foo
echo ...stdout appending
echo foo>foo
echo foo >>foo

View File

@ -120,11 +120,14 @@ word
...stdout redirection
foo
foo@space@
foo7@space@@or_broken@foo@space@
foo9@space@@or_broken@foo@space@
@todo_wine@foo1
@todo_wine@foo11
@todo_wine@foo12
foo@tab@
foo@space@
foo@tab@
foo7@space@@or_broken@foo@tab@
foo9@space@@or_broken@foo@tab@
foo1
foo11
foo12
...stdout appending
foo
foo@space@
@ -133,12 +136,12 @@ foob@space@
fooc@space@
foob@space@
fooc@space@
@todo_wine@food1
@todo_wine@foob@space@
@todo_wine@fooc@space@
@todo_wine@food1
@todo_wine@food2
@todo_wine@food21
food1
foob@space@
fooc@space@
food1
food2
food21
@todo_wine@foo7@space@@space@@or_broken@not supported@space@
@todo_wine@foo@or_broken@not supported
@todo_wine@------------ Testing ^ escape character --------------
@ -621,7 +624,7 @@ lulu
file created in read-only dir
------------ Testing CALL --------------
foo@space@
@todo_wine@foo 8
foo 8
foo@space@@space@
foo bar@space@
@todo_wine@foo ""@space@

View File

@ -1944,10 +1944,11 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
}
/* See if 1>, 2> etc, in which case we have some patching up
to do */
if (curPos != extraSpace &&
*(curPos-1)>='1' && *(curPos-1)<='9') {
to do (provided there's a preceding whitespace, and enough
chars read so far) */
if (curStringLen > 2
&& (*(curPos-1)>='1') && (*(curPos-1)<='9')
&& ((*(curPos-2)==' ') || (*(curPos-2)=='\t'))) {
curStringLen--;
curString[curStringLen] = 0x00;
curCopyTo[(*curLen)++] = *(curPos-1);