[PATCH 4/7] CMD.exe: Add suport for if 1==1 echo yes

Jason Edmeades jason.edmeades at googlemail.com
Tue Sep 11 15:43:05 CDT 2007


Add support when there is no space delimiter between the parms
and the condition.
---
 programs/cmd/builtins.c |    2 ++
 programs/cmd/wcmdmain.c |    8 +++++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 8fbf292..ee8f1b3 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -1160,6 +1160,8 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) {
   else {
     strcpyW (condition, param1);
   }
+  WINE_TRACE("Condition: %s\n", wine_dbgstr_w(condition));
+
   if (!lstrcmpiW (condition, errlvlW)) {
     if (errorlevel >= atoiW(WCMD_parameter (p, 1+negate, NULL))) test = 1;
     WCMD_parameter (p, 2+negate, &command);
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index b44b0ed..818710c 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -708,6 +708,8 @@ void WCMD_execute (WCHAR *command,
     }
     p = WCMD_strtrim_leading_spaces (&whichcmd[count]);
     WCMD_parse (p, quals, param1, param2);
+    WINE_TRACE("param1: %s, param2: %s\n", wine_dbgstr_w(param1), wine_dbgstr_w(param2));
+
     switch (i) {
 
       case WCMD_ATTRIB:
@@ -1313,11 +1315,15 @@ int p = 0;
       case '\0':
         return;
       default:
-	while ((*s != '\0') && (*s != ' ') && (*s != '\t')) {
+	while ((*s != '\0') && (*s != ' ') && (*s != '\t')
+               && (*s != '=')  && (*s != ',') ) {
 	  if (p == 0) *p1++ = *s++;
 	  else if (p == 1) *p2++ = *s++;
 	  else s++;
 	}
+        /* Skip concurrent parms */
+	while ((*s == ' ') || (*s == '\t') || (*s == '=')  || (*s == ',') ) s++;
+
         if (p == 0) *p1 = '\0';
         if (p == 1) *p2 = '\0';
 	p++;
-- 
1.5.0




More information about the wine-patches mailing list