[5/8] cmd: Fix REM tab handling

Frédéric Delanoy frederic.delanoy at gmail.com
Tue Aug 23 15:54:53 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, 17 insertions(+), 2 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 a9e0e5e..8a3189c 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -1741,7 +1741,8 @@ 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',' ' ,'\0'};
+    const WCHAR remTabCmd[] = {'r','e','m','\t','\0'};
     const WCHAR forCmd[]    = {'f','o','r',' ' ,'\0'};
     const WCHAR forTabCmd[] = {'f','o','r','\t','\0'};
     const WCHAR ifCmd[]  = {'i','f',' ','\0'};
@@ -1832,7 +1833,9 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
 
         /* If command starts with 'rem', ignore any &&, ( etc */
         if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
-          curPos, 4, remCmd, -1) == CSTR_EQUAL) {
+          curPos, 4, remCmd, -1) == CSTR_EQUAL
+            || CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
+          curPos, 4, remTabCmd, -1) == CSTR_EQUAL) {
           inRem = TRUE;
 
         /* If command starts with 'for', handle ('s mid line after IN or DO */
-- 
1.7.6




More information about the wine-patches mailing list