Detlef Riekenberg : cmd: Allow GOTO to a label which has a following whitespace, with test.
Alexandre Julliard
julliard at winehq.org
Mon Dec 13 10:43:20 CST 2010
Module: wine
Branch: master
Commit: d62c6bb77f923bfa3d635f9e484feb78d8c3f78c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d62c6bb77f923bfa3d635f9e484feb78d8c3f78c
Author: Detlef Riekenberg <wine.dev at web.de>
Date: Mon Dec 13 00:04:19 2010 +0100
cmd: Allow GOTO to a label which has a following whitespace, with test.
---
programs/cmd/builtins.c | 14 ++++++++++++--
programs/cmd/tests/test_builtins.cmd | 3 +++
programs/cmd/tests/test_builtins.cmd.exp | 1 +
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 5ccbb8f..8c3f727 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -1150,6 +1150,7 @@ void WCMD_give_help (WCHAR *command) {
void WCMD_goto (CMD_LIST **cmdList) {
WCHAR string[MAX_PATH];
+ WCHAR current[MAX_PATH];
/* Do not process any more parts of a processed multipart or multilines command */
if (cmdList) *cmdList = NULL;
@@ -1174,8 +1175,17 @@ void WCMD_goto (CMD_LIST **cmdList) {
SetFilePointer (context -> h, 0, NULL, FILE_BEGIN);
while (WCMD_fgets (string, sizeof(string)/sizeof(WCHAR), context -> h)) {
str = string;
- while (isspaceW(*str)) str++;
- if ((*str == ':') && (lstrcmpiW (++str, paramStart) == 0)) return;
+ while (isspaceW (*str)) str++;
+ if (*str == ':') {
+ DWORD index = 0;
+ str++;
+ while (((current[index] = str[index])) && (!isspaceW (current[index])))
+ index++;
+
+ /* ignore space at the end */
+ current[index] = 0;
+ if (lstrcmpiW (current, paramStart) == 0) return;
+ }
}
WCMD_output (WCMD_LoadMessage(WCMD_NOTARGET));
}
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index 375b7a1..2b117e4 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -88,3 +88,6 @@ echo goto with a leading space worked
if c==c goto dest3
:dest3
echo goto with a leading tab worked
+if d==d goto dest4
+:dest4 at space@
+echo goto with a following space worked
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index dee2c5b..e4644d3 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -82,3 +82,4 @@ if /I seems to work
goto with no leading space worked
goto with a leading space worked
goto with a leading tab worked
+goto with a following space worked
More information about the wine-cvs
mailing list