[1/2] cmd: Add escape carat char mid-line feature and test cases

John Chow jkchow at ucla.edu
Thu Mar 11 01:01:41 CST 2010


---
 programs/cmd/tests/test_builtins.cmd     |    4 ++++
 programs/cmd/tests/test_builtins.cmd.exp |    3 +++
 programs/cmd/wcmdmain.c                  |    7 +++++++
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index ed2b75b..44eecaa 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -43,3 +43,7 @@ if /i foo==FOO echo if /i seems to work
 if /i not foo==FOO echo if /i seems to be broken
 if /I foo==FOO echo if /I seems to work
 if /I not foo==FOO echo if /I seems to be broken
+
+echo ---------- Testing caret escape char ------------
+echo the caret char should escape special char such as pipe in echo
+echo This should ouput "| more" after: ^| more
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index 2c0e980..f5318aa 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -24,3 +24,6 @@ Testing case sensitivity with and without /i option
 if seems to default to case sensitivity
 if /i seems to work
 if /I seems to work
+---------- Testing caret escape char ------------
+the caret char should escape special char such as pipe in echo
+This should ouput "| more" after: | more
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index b2243e3..070ed50 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -2017,6 +2017,13 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF
                 }
                 break;
 
+      case '^': if (!inQuotes) {
+                  curPos++;
+                  curCopyTo[(*curLen)++] = *curPos;
+                } else {
+                  curCopyTo[(*curLen)++] = *curPos;
+                }
+                break;
       case '&': if (!inQuotes) {
                   lastWasRedirect = FALSE;
 
-- 
1.6.3.3


--------------080509010606090105000105--



More information about the wine-patches mailing list