mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 04:33:38 +00:00
- Ignore special characters in a REM line.
- Make the \n-printing in batch files with ECHO on more consistant with how Windows does it. svn path=/trunk/; revision=39890
This commit is contained in:
parent
58e2d39f21
commit
79c11338fa
2 changed files with 15 additions and 9 deletions
|
@ -285,6 +285,7 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd
|
|||
/* Echo batch file line */
|
||||
if (bEcho && Cmd->Type != C_QUIET)
|
||||
{
|
||||
ConOutChar(_T('\n'));
|
||||
PrintPrompt();
|
||||
EchoCommand(Cmd);
|
||||
ConOutChar(_T('\n'));
|
||||
|
@ -292,15 +293,9 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd
|
|||
|
||||
bc->current = Cmd;
|
||||
ExecuteCommand(Cmd);
|
||||
if (bEcho && !bIgnoreEcho && Cmd->Type != C_QUIET)
|
||||
ConOutChar(_T('\n'));
|
||||
FreeCommand(Cmd);
|
||||
bIgnoreEcho = FALSE;
|
||||
}
|
||||
|
||||
/* Don't print a newline for this command */
|
||||
bIgnoreEcho = TRUE;
|
||||
|
||||
TRACE ("Batch: returns TRUE\n");
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -522,12 +522,22 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* Parse a REM command */
|
||||
static PARSED_COMMAND *ParseRem(void)
|
||||
{
|
||||
/* Just ignore the rest of the line */
|
||||
while (CurChar && CurChar != _T('\n'))
|
||||
ParseChar();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static PARSED_COMMAND *ParseCommandPart(void)
|
||||
{
|
||||
TCHAR ParsedLine[CMDLINE_LENGTH];
|
||||
TCHAR *Pos;
|
||||
DWORD TailOffset;
|
||||
PARSED_COMMAND *Cmd;
|
||||
PARSED_COMMAND *(*Func)(void);
|
||||
REDIRECTION *RedirList = NULL;
|
||||
int Type;
|
||||
|
||||
|
@ -595,8 +605,9 @@ static PARSED_COMMAND *ParseCommandPart(void)
|
|||
TailOffset = Pos - ParsedLine;
|
||||
|
||||
/* Check for special forms */
|
||||
if (_tcsicmp(ParsedLine, _T("for")) == 0 ||
|
||||
_tcsicmp(ParsedLine, _T("if")) == 0)
|
||||
if ((Func = ParseFor, _tcsicmp(ParsedLine, _T("for")) == 0) ||
|
||||
(Func = ParseIf, _tcsicmp(ParsedLine, _T("if")) == 0) ||
|
||||
(Func = ParseRem, _tcsicmp(ParsedLine, _T("rem")) == 0))
|
||||
{
|
||||
ParseToken(0, STANDARD_SEPS);
|
||||
/* Do special parsing only if it's not followed by /? */
|
||||
|
@ -608,7 +619,7 @@ static PARSED_COMMAND *ParseCommandPart(void)
|
|||
FreeRedirection(RedirList);
|
||||
return NULL;
|
||||
}
|
||||
return _totlower(*ParsedLine) == _T('f') ? ParseFor() : ParseIf();
|
||||
return Func();
|
||||
}
|
||||
Pos = _stpcpy(Pos, _T(" /?"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue