cmd: Fix REM tab handling.

This commit is contained in:
Frédéric Delanoy 2011-08-25 00:48:21 +02:00 committed by Alexandre Julliard
parent d147df418c
commit 6d3fd3abcd
3 changed files with 15 additions and 4 deletions

View File

@ -58,12 +58,18 @@ rem Hello
rem Hello || foo
rem echo lol
rem echo foo & echo bar
rem @tab@ Hello
rem@tab@ Hello
rem@tab@echo foo & echo bar
@echo on
rem Hello
rem Hello
rem Hello || foo
rem echo lol
rem echo foo & echo bar
rem @tab@ Hello
rem@tab@ Hello
rem@tab@echo foo & echo bar
@echo off
echo ------------ Testing redirection operators --------------

View File

@ -106,6 +106,12 @@ word
@pwd@>rem echo lol@space@
@pwd@>rem echo foo & echo bar@space@
@pwd@>rem @tab@ Hello@space@
@pwd@>rem@tab@ Hello@space@
@pwd@>rem@tab@echo foo & echo bar@space@
------------ Testing redirection operators --------------
...stdout redirection
foo

View File

@ -1753,7 +1753,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
CMD_LIST *lastEntry = NULL;
CMD_DELIMITERS prevDelim = CMD_NONE;
static WCHAR *extraSpace = NULL; /* Deliberately never freed */
const WCHAR remCmd[] = {'r','e','m',' ','\0'};
const WCHAR remCmd[] = {'r','e','m'};
const WCHAR forCmd[] = {'f','o','r'};
const WCHAR ifCmd[] = {'i','f',' ','\0'};
const WCHAR ifElse[] = {'e','l','s','e',' ','\0'};
@ -1840,9 +1840,8 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
if (curStringLen == 0 && curCopyTo == curString) {
const WCHAR forDO[] = {'d','o'};
/* If command starts with 'rem', ignore any &&, ( etc */
if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
curPos, 4, remCmd, -1) == CSTR_EQUAL) {
/* If command starts with 'rem ', ignore any &&, ( etc. */
if (WCMD_keyword_ws_found(remCmd, sizeof(remCmd)/sizeof(remCmd[0]), curPos)) {
inRem = TRUE;
} else if (WCMD_keyword_ws_found(forCmd, sizeof(forCmd)/sizeof(forCmd[0]), curPos)) {