Commit 55be713d authored by Carlos Rafael Ramirez's avatar Carlos Rafael Ramirez Committed by Alexandre Julliard

cmd: When 'if' condition is not met, ignore the next commands in the list.

parent aa552066
...@@ -1574,6 +1574,9 @@ static void WCMD_part_execute(CMD_LIST **cmdList, const WCHAR *firstcmd, ...@@ -1574,6 +1574,9 @@ static void WCMD_part_execute(CMD_LIST **cmdList, const WCHAR *firstcmd,
} }
} }
if (curPosition == *cmdList) *cmdList = (*cmdList)->nextcommand; if (curPosition == *cmdList) *cmdList = (*cmdList)->nextcommand;
} else if (!processThese) {
if (curPosition == *cmdList) *cmdList = (*cmdList)->nextcommand;
WINE_TRACE("Ignore the next command as well (next = %p)\n", *cmdList);
} else { } else {
WINE_TRACE("Found end of this IF statement (next = %p)\n", *cmdList); WINE_TRACE("Found end of this IF statement (next = %p)\n", *cmdList);
break; break;
......
...@@ -836,6 +836,17 @@ if 1 GEQ "10" (echo 1 GEQ "10") else echo foo ...@@ -836,6 +836,17 @@ if 1 GEQ "10" (echo 1 GEQ "10") else echo foo
if "1" GEQ "10" (echo 1 GEQ "10") else echo foo if "1" GEQ "10" (echo 1 GEQ "10") else echo foo
if '1' GEQ "10" (echo '1' GEQ "10") else echo foo if '1' GEQ "10" (echo '1' GEQ "10") else echo foo
if "10" GEQ "10" (echo "10" GEQ "10") if "10" GEQ "10" (echo "10" GEQ "10")
echo --- unconditional ampersand after if one line
if "0"=="0" echo 1 & echo 2 & echo 3 else echo 4
echo ---
echo x & if "0"=="1" echo 1 & echo 2
echo ---
echo x & if "0"=="1" echo 1 & echo 2 & echo 3
echo ---
echo x & if "0"=="1" (echo 1 & echo 2 & echo 3)
echo ---
echo x & if "0"=="1" echo 1 & echo 2 & echo 3 else echo 4
echo ---
goto :endIfCompOpsSubroutines goto :endIfCompOpsSubroutines
rem IF subroutines helpers rem IF subroutines helpers
......
...@@ -645,6 +645,19 @@ foo ...@@ -645,6 +645,19 @@ foo
foo foo
'1' GEQ "10" '1' GEQ "10"
"10" GEQ "10" "10" GEQ "10"
--- unconditional ampersand after if one line
1@space@
2@space@
3 else echo 4
---
x@space@
---
x@space@
---
x@space@
---
x@space@
---
------------ Testing for ------------ ------------ Testing for ------------
--- plain FOR --- plain FOR
A A
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment