[PATCH 2/5] [cmd] Add circumflex support into command shell

Ann and Jason Edmeades jason at edmeades.me.uk
Tue Sep 25 18:07:28 CDT 2012


Support for ^ in the command processing, escaping the next character.

[Fixes most of 18346]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120926/32579734/attachment.html>
-------------- next part --------------
From 1da513a7a4d85fbba231026e7f586265ca7f077c Mon Sep 17 00:00:00 2001
From: Jason Edmeades <jason at edmeades.me.uk>
Date: Tue, 25 Sep 2012 13:45:28 +0100
Subject: [PATCH 2/5] [cmd] Add circumflex support into command shell

Support for ^ in the command processing, escaping the next character.

[Fixes most of 18346]
---
 programs/cmd/tests/test_builtins.cmd.exp |   34 +++++++++++++++---------------
 programs/cmd/wcmdmain.c                  |    4 ++++
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index a4f874c..b019280 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -123,7 +123,7 @@ bar2
 'a', '~`+', '.{}!+b'
 'a', 'b', ''
 '"a;b"', '', ''
- at todo_wine@'a', 'b', ''
+'a', 'b', ''
 'a[b]{c}(d)e', '', ''
 'a', '', ''
 second line
@@ -197,25 +197,25 @@ A
 B
 C
 ------------ Testing circumflex escape character ------------
- at todo_wine@hello, world
- at todo_wine@hello, world
- at todo_wine@hell^o, world
- at todo_wine@hell^o, world
+hello, world
+hello, world
+hell^o, world
+hell^o, world
+baz
 baz
- at todo_wine@baz
- at todo_wine@foo | echo bar
- at todo_wine@foo & echo bar
- at todo_wine@bak &
+foo | echo bar
+foo & echo bar
+bak &
 baz at space@
 0 at or_broken@1
- at todo_wine@foo > foo
- at todo_wine@<
- at todo_wine@ffoof
- at todo_wine@FOO=bar | baz
- at todo_wine@0
- at todo_wine@FOO=bar ^| baz
- at todo_wine@bar | baz
- at todo_wine@0
+foo > foo
+<
+ffoof
+FOO=bar | baz
+0
+FOO=bar ^| baz
+bar | baz
+0
 ------------ Testing 'set' ------------
 1
 0
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 94d2b76..a328f83 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -2070,6 +2070,10 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
                 }
                 break;
 
+      case '^': if (!inQuotes) curPos++;
+                curCopyTo[(*curLen)++] = *curPos;
+                break;
+
       case '&': if (!inQuotes) {
                   lastWasRedirect = FALSE;
 
-- 
1.7.9.5


More information about the wine-patches mailing list