mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 17:01:49 +00:00
[CMD] Fix support for newlines in the emulated parenthesed set block of the "for" command.
CORE-7998
This commit is contained in:
parent
8dd89c7cfc
commit
8340574fe3
1 changed files with 12 additions and 2 deletions
|
@ -55,7 +55,7 @@ static TCHAR CurrentToken[CMDLINE_LENGTH];
|
||||||
static int CurrentTokenType;
|
static int CurrentTokenType;
|
||||||
static int InsideBlock;
|
static int InsideBlock;
|
||||||
|
|
||||||
static TCHAR ParseChar()
|
static TCHAR ParseChar(void)
|
||||||
{
|
{
|
||||||
TCHAR Char;
|
TCHAR Char;
|
||||||
|
|
||||||
|
@ -69,7 +69,9 @@ restart:
|
||||||
* even separate tokens.
|
* even separate tokens.
|
||||||
*/
|
*/
|
||||||
do
|
do
|
||||||
|
{
|
||||||
Char = *ParsePos++;
|
Char = *ParsePos++;
|
||||||
|
}
|
||||||
while (Char == _T('\r'));
|
while (Char == _T('\r'));
|
||||||
|
|
||||||
if (!Char)
|
if (!Char)
|
||||||
|
@ -91,7 +93,7 @@ restart:
|
||||||
return CurChar = Char;
|
return CurChar = Char;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ParseError()
|
static void ParseError(void)
|
||||||
{
|
{
|
||||||
error_syntax(CurrentTokenType != TOK_END ? CurrentToken : NULL);
|
error_syntax(CurrentTokenType != TOK_END ? CurrentToken : NULL);
|
||||||
bParseError = TRUE;
|
bParseError = TRUE;
|
||||||
|
@ -317,6 +319,7 @@ static PARSED_COMMAND *ParseBlock(REDIRECTION *RedirList)
|
||||||
|
|
||||||
if (CurrentTokenType == TOK_END_BLOCK)
|
if (CurrentTokenType == TOK_END_BLOCK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Skip past the \n */
|
/* Skip past the \n */
|
||||||
ParseChar();
|
ParseChar();
|
||||||
}
|
}
|
||||||
|
@ -502,6 +505,13 @@ static PARSED_COMMAND *ParseFor(void)
|
||||||
if (Type == TOK_END_BLOCK)
|
if (Type == TOK_END_BLOCK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (Type == TOK_END)
|
||||||
|
{
|
||||||
|
/* Skip past the \n */
|
||||||
|
ParseChar();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (Type != TOK_NORMAL)
|
if (Type != TOK_NORMAL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue