[PATCH 05/12] CMD.exe: GOTO throws away any preloaded multi part/line command

Jason Edmeades jason.edmeades at googlemail.com
Thu Jun 14 17:06:41 CDT 2007


eg: goto :fred && echo this will not be issued
---
 programs/cmd/batch.c    |    2 +-
 programs/cmd/builtins.c |    5 ++++-
 programs/cmd/wcmd.h     |    2 +-
 programs/cmd/wcmdmain.c |    2 +-
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c
index b2a07cb..cc9d835 100644
--- a/programs/cmd/batch.c
+++ b/programs/cmd/batch.c
@@ -97,7 +97,7 @@ void WCMD_batch (WCHAR *file, WCHAR *command, int called, WCHAR *startLabel, HAN
   /* If processing a call :label, 'goto' the label in question */
   if (startLabel) {
     strcpyW(param1, startLabel);
-    WCMD_goto();
+    WCMD_goto(NULL);
   }
 
 /*
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 9a45bf8..9bee191 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -686,10 +686,13 @@ void WCMD_give_help (WCHAR *command) {
  * FIXME: DOS is supposed to allow labels with spaces - we don't.
  */
 
-void WCMD_goto (void) {
+void WCMD_goto (CMD_LIST **cmdList) {
 
   WCHAR string[MAX_PATH];
 
+  /* Do not process any more parts of a processed multipart or multilines command */
+  *cmdList = NULL;
+
   if (param1[0] == 0x00) {
     WCMD_output (WCMD_LoadMessage(WCMD_NOARG));
     return;
diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h
index b6258e5..c1af0bd 100644
--- a/programs/cmd/wcmd.h
+++ b/programs/cmd/wcmd.h
@@ -53,7 +53,7 @@ void WCMD_enter_paged_mode(const WCHAR *);
 void WCMD_exit (void);
 void WCMD_for (WCHAR *, CMD_LIST **cmdList);
 void WCMD_give_help (WCHAR *command);
-void WCMD_goto (void);
+void WCMD_goto (CMD_LIST **cmdList);
 void WCMD_if (WCHAR *, CMD_LIST **cmdList);
 void WCMD_leave_paged_mode(void);
 void WCMD_more (WCHAR *);
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index fdb8089..30c1921 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -712,7 +712,7 @@ void WCMD_process_command (WCHAR *command, CMD_LIST **cmdList)
         WCMD_for (p, cmdList);
         break;
       case WCMD_GOTO:
-        WCMD_goto ();
+        WCMD_goto (cmdList);
         break;
       case WCMD_HELP:
         WCMD_give_help (p);
-- 
1.5.0




More information about the wine-patches mailing list