[5/8] cmd: Fix REM tab handling (try 2)
Frédéric Delanoy
frederic.delanoy at gmail.com
Wed Aug 24 17:06:06 CDT 2011
---
programs/cmd/tests/test_builtins.cmd | 6 ++++++
programs/cmd/tests/test_builtins.cmd.exp | 6 ++++++
programs/cmd/wcmdmain.c | 7 +++----
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index 7c3353f..cd46dbd 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -58,12 +58,18 @@ rem Hello
rem Hello || foo
rem echo lol
rem echo foo & echo bar
+rem @tab@ Hello
+rem at tab@ Hello
+rem at 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 at tab@ Hello
+rem at tab@echo foo & echo bar
@echo off
echo ------------ Testing redirection operators --------------
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index 7435c72..dafb6a3 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -106,6 +106,12 @@ word
@pwd@>rem echo lol at space@
@pwd@>rem echo foo & echo bar at space@
+
+ at pwd@>rem @tab@ Hello at space@
+
+ at pwd@>rem at tab@ Hello at space@
+
+ at pwd@>rem at tab@echo foo & echo bar at space@
------------ Testing redirection operators --------------
...stdout redirection
foo
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 47af612..3efabfa 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -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)) {
--
1.7.6
More information about the wine-patches
mailing list