Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
1a9413b9
Commit
1a9413b9
authored
Sep 02, 2012
by
Jason Edmeades
Committed by
Alexandre Julliard
Sep 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: for /l with zero iterations failed to skip its commands.
parent
3a25888f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
9 deletions
+18
-9
builtins.c
programs/cmd/builtins.c
+11
-7
test_builtins.cmd
programs/cmd/tests/test_builtins.cmd
+5
-0
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+2
-2
No files found.
programs/cmd/builtins.c
View file @
1a9413b9
...
...
@@ -968,7 +968,7 @@ void WCMD_echo (const WCHAR *command)
*/
static
void
WCMD_part_execute
(
CMD_LIST
**
cmdList
,
const
WCHAR
*
firstcmd
,
const
WCHAR
*
variable
,
const
WCHAR
*
value
,
BOOL
isIF
,
BOOL
conditionTRUE
)
BOOL
isIF
,
BOOL
executecmds
)
{
CMD_LIST
*
curPosition
=
*
cmdList
;
int
myDepth
=
(
*
cmdList
)
->
bracketDepth
;
...
...
@@ -976,13 +976,13 @@ static void WCMD_part_execute(CMD_LIST **cmdList, const WCHAR *firstcmd,
WINE_TRACE
(
"cmdList(%p), firstCmd(%p), with variable '%s'='%s', doIt(%d)
\n
"
,
cmdList
,
wine_dbgstr_w
(
firstcmd
),
wine_dbgstr_w
(
variable
),
wine_dbgstr_w
(
value
),
conditionTRUE
);
executecmds
);
/* Skip leading whitespace between condition and the command */
while
(
firstcmd
&&
*
firstcmd
&&
(
*
firstcmd
==
' '
||
*
firstcmd
==
'\t'
))
firstcmd
++
;
/* Process the first command, if there is one */
if
(
conditionTRUE
&&
firstcmd
&&
*
firstcmd
)
{
if
(
executecmds
&&
firstcmd
&&
*
firstcmd
)
{
WCHAR
*
command
=
WCMD_strdupW
(
firstcmd
);
WCMD_execute
(
firstcmd
,
(
*
cmdList
)
->
redirects
,
variable
,
value
,
cmdList
);
HeapFree
(
GetProcessHeap
(),
0
,
command
);
...
...
@@ -994,9 +994,7 @@ static void WCMD_part_execute(CMD_LIST **cmdList, const WCHAR *firstcmd,
/* Process any other parts of the command */
if
(
*
cmdList
)
{
BOOL
processThese
=
TRUE
;
if
(
isIF
)
processThese
=
conditionTRUE
;
BOOL
processThese
=
executecmds
;
while
(
*
cmdList
)
{
static
const
WCHAR
ifElse
[]
=
{
'e'
,
'l'
,
's'
,
'e'
};
...
...
@@ -1372,8 +1370,14 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
thisCmdStart
=
cmdStart
;
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
thisNum
,
FALSE
,
TRUE
);
cmdEnd
=
thisCmdStart
;
}
/* Now skip over the subsequent commands if we did not perform the for loop */
if
(
thisCmdStart
==
cmdStart
)
{
WINE_TRACE
(
"Skipping for loop commands due to no valid iterations
\n
"
);
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
thisNum
,
FALSE
,
FALSE
);
}
cmdEnd
=
thisCmdStart
;
}
/* When the loop ends, either something like a GOTO or EXIT /b has terminated
...
...
programs/cmd/tests/test_builtins.cmd
View file @
1a9413b9
...
...
@@ -685,6 +685,11 @@ for /L %%i in (1,1,1) do echo %%i
for /L %%i in (1,-2,-1) do echo %%i
for /L %%i in (-1,-1,-1) do echo %%i
for /L %%i in (1,2, 3) do echo %%i
rem Test zero iteration skips the body of the for
for /L %%i in (2,2,1) do (
echo %%i
echo FAILED
)
echo --- for /a
rem No output when using "set expr" syntax, unless in interactive mode
rem Need to use "set envvar=expr" to use in a batch script
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
1a9413b9
...
...
@@ -469,8 +469,8 @@ bar
2
1
-1
@todo_wine@
ErrorLevel 0
@todo_wine@
ErrorLevel 0
ErrorLevel 0
ErrorLevel 0
1
2
3
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment