Author: jmorlan Date: Fri Mar 6 20:27:42 2009 New Revision: 39890
URL: http://svn.reactos.org/svn/reactos?rev=39890&view=rev Log: - Ignore special characters in a REM line. - Make the \n-printing in batch files with ECHO on more consistant with how Windows does it.
Modified: trunk/reactos/base/shell/cmd/batch.c trunk/reactos/base/shell/cmd/parser.c
Modified: trunk/reactos/base/shell/cmd/batch.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/batch.c?rev=... ============================================================================== --- trunk/reactos/base/shell/cmd/batch.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/batch.c [iso-8859-1] Fri Mar 6 20:27:42 2009 @@ -285,6 +285,7 @@ /* Echo batch file line */ if (bEcho && Cmd->Type != C_QUIET) { + ConOutChar(_T('\n')); PrintPrompt(); EchoCommand(Cmd); ConOutChar(_T('\n')); @@ -292,14 +293,8 @@
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");
Modified: trunk/reactos/base/shell/cmd/parser.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/parser.c?rev... ============================================================================== --- trunk/reactos/base/shell/cmd/parser.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/parser.c [iso-8859-1] Fri Mar 6 20:27:42 2009 @@ -522,12 +522,22 @@ 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 @@ 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 @@ FreeRedirection(RedirList); return NULL; } - return _totlower(*ParsedLine) == _T('f') ? ParseFor() : ParseIf(); + return Func(); } Pos = _stpcpy(Pos, _T(" /?")); }