Commit eba7092f authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

cmd: Allow numbered redirects at the beginning of a line.

parent 35c8f15b
...@@ -176,6 +176,15 @@ del foo ...@@ -176,6 +176,15 @@ del foo
echo foo> foo echo foo> foo
echo foo7 7>> foo || (echo not supported & del foo) echo foo7 7>> foo || (echo not supported & del foo)
if exist foo (type foo) else echo not supported if exist foo (type foo) else echo not supported
echo --- redirect at beginning of line
>foo (echo foo)
type foo
1>foo (echo foo1)
type foo
2>foo (echo foo2 >&2)
type foo
>>foo (echo fooA)
type foo
echo --- redirections within IF statements echo --- redirections within IF statements
if 1==1 echo foo1>bar if 1==1 echo foo1>bar
type bar & del bar type bar & del bar
......
...@@ -204,6 +204,12 @@ food2 ...@@ -204,6 +204,12 @@ food2
food21 food21
@todo_wine@foo7@space@@space@@or_broken@not supported@space@ @todo_wine@foo7@space@@space@@or_broken@not supported@space@
@todo_wine@foo@or_broken@not supported @todo_wine@foo@or_broken@not supported
--- redirect at beginning of line
foo
foo1
foo2@space@
foo2@space@
fooA
--- redirections within IF statements --- redirections within IF statements
foo1 foo1
foo2 foo2
......
...@@ -2070,9 +2070,9 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE ...@@ -2070,9 +2070,9 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
/* See if 1>, 2> etc, in which case we have some patching up /* See if 1>, 2> etc, in which case we have some patching up
to do (provided there's a preceding whitespace, and enough to do (provided there's a preceding whitespace, and enough
chars read so far) */ chars read so far) */
if (curStringLen > 2 if (curPos[-1] >= '1' && curPos[-1] <= '9'
&& (*(curPos-1)>='1') && (*(curPos-1)<='9') && (curStringLen == 1 ||
&& ((*(curPos-2)==' ') || (*(curPos-2)=='\t'))) { curPos[-2] == ' ' || curPos[-2] == '\t')) {
curStringLen--; curStringLen--;
curString[curStringLen] = 0x00; curString[curStringLen] = 0x00;
curCopyTo[(*curLen)++] = *(curPos-1); curCopyTo[(*curLen)++] = *(curPos-1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment