From 6d3fd3abcdcd67142c43e0f4a3357b1c32a15563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delanoy?= Date: Thu, 25 Aug 2011 00:48:21 +0200 Subject: [PATCH] cmd: Fix REM tab handling. --- 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 7c3353ff698..cd46dbd838a 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@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 -------------- diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 7435c72b88a..dafb6a3c66e 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@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 diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 47af612bc7b..3efabfa72d8 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)) {