Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
141e33b8
Commit
141e33b8
authored
Sep 04, 2012
by
Jason Edmeades
Committed by
Alexandre Julliard
Sep 05, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: More generic zero iteration for loop fix.
parent
4f71f4af
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
12 deletions
+44
-12
builtins.c
programs/cmd/builtins.c
+17
-6
test_builtins.cmd
programs/cmd/tests/test_builtins.cmd
+21
-3
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+6
-3
No files found.
programs/cmd/builtins.c
View file @
141e33b8
...
@@ -1084,6 +1084,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -1084,6 +1084,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
BOOL
expandDirs
=
FALSE
;
BOOL
expandDirs
=
FALSE
;
BOOL
useNumbers
=
FALSE
;
BOOL
useNumbers
=
FALSE
;
BOOL
doFileset
=
FALSE
;
BOOL
doFileset
=
FALSE
;
BOOL
doExecuted
=
FALSE
;
/* Has the 'do' part been executed */
LONG
numbers
[
3
]
=
{
0
,
0
,
0
};
/* Defaults to 0 in native */
LONG
numbers
[
3
]
=
{
0
,
0
,
0
};
/* Defaults to 0 in native */
int
itemNum
;
int
itemNum
;
CMD_LIST
*
thisCmdStart
;
CMD_LIST
*
thisCmdStart
;
...
@@ -1233,6 +1234,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -1233,6 +1234,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
{
{
thisCmdStart
=
cmdStart
;
thisCmdStart
=
cmdStart
;
WINE_TRACE
(
"Processing FOR filename %s
\n
"
,
wine_dbgstr_w
(
fd
.
cFileName
));
WINE_TRACE
(
"Processing FOR filename %s
\n
"
,
wine_dbgstr_w
(
fd
.
cFileName
));
doExecuted
=
TRUE
;
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
fd
.
cFileName
,
FALSE
,
TRUE
);
fd
.
cFileName
,
FALSE
,
TRUE
);
}
}
...
@@ -1241,6 +1243,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -1241,6 +1243,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
FindClose
(
hff
);
FindClose
(
hff
);
}
}
}
else
{
}
else
{
doExecuted
=
TRUE
;
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
item
,
FALSE
,
TRUE
);
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
item
,
FALSE
,
TRUE
);
}
}
...
@@ -1310,6 +1313,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -1310,6 +1313,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
/* FIXME: The following should be moved into its own routine and
/* FIXME: The following should be moved into its own routine and
reused for the string literal parsing below */
reused for the string literal parsing below */
thisCmdStart
=
cmdStart
;
thisCmdStart
=
cmdStart
;
doExecuted
=
TRUE
;
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
parm
,
FALSE
,
TRUE
);
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
parm
,
FALSE
,
TRUE
);
cmdEnd
=
thisCmdStart
;
cmdEnd
=
thisCmdStart
;
}
}
...
@@ -1340,6 +1344,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -1340,6 +1344,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
/* FIXME: The following should be moved into its own routine and
/* FIXME: The following should be moved into its own routine and
reused for the string literal parsing below */
reused for the string literal parsing below */
thisCmdStart
=
cmdStart
;
thisCmdStart
=
cmdStart
;
doExecuted
=
TRUE
;
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
parm
,
FALSE
,
TRUE
);
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
parm
,
FALSE
,
TRUE
);
cmdEnd
=
thisCmdStart
;
cmdEnd
=
thisCmdStart
;
}
}
...
@@ -1369,17 +1374,23 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -1369,17 +1374,23 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
WINE_TRACE
(
"Processing FOR number %s
\n
"
,
wine_dbgstr_w
(
thisNum
));
WINE_TRACE
(
"Processing FOR number %s
\n
"
,
wine_dbgstr_w
(
thisNum
));
thisCmdStart
=
cmdStart
;
thisCmdStart
=
cmdStart
;
doExecuted
=
TRUE
;
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
thisNum
,
FALSE
,
TRUE
);
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
thisNum
,
FALSE
,
TRUE
);
}
}
/* 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
;
cmdEnd
=
thisCmdStart
;
}
}
/* Now skip over the do part if we did not perform the for loop so far.
We store in cmdEnd the next command after the do block, but we only
know this if something was run. If it has not been, we need to calculate
it. */
if
(
!
doExecuted
)
{
thisCmdStart
=
cmdStart
;
WINE_TRACE
(
"Skipping for loop commands due to no valid iterations
\n
"
);
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
NULL
,
NULL
,
FALSE
,
FALSE
);
cmdEnd
=
thisCmdStart
;
}
/* When the loop ends, either something like a GOTO or EXIT /b has terminated
/* When the loop ends, either something like a GOTO or EXIT /b has terminated
all processing, OR it should be pointing to the end of && processing OR
all processing, OR it should be pointing to the end of && processing OR
it should be pointing at the NULL end of bracket for the DO. The return
it should be pointing at the NULL end of bracket for the DO. The return
...
...
programs/cmd/tests/test_builtins.cmd
View file @
141e33b8
...
@@ -643,9 +643,27 @@ echo > bazbaz
...
@@ -643,9 +643,27 @@ echo > bazbaz
echo --- basic wildcards
echo --- basic wildcards
for %%i in (ba*) do echo %%i
for %%i in (ba*) do echo %%i
echo --- for /d
echo --- for /d
for /d %%i in (baz foo bar) do echo %%i
for /d %%i in (baz foo bar) do echo %%i 2>&1
rem FIXME for /d incorrectly parses when wildcards are used
rem Confirm we dont match files:
rem for /d %%i in (bazb*) do echo %%i
for /d %%i in (bazb*) do echo %%i 2>&1
for /d %%i in (bazb2*) do echo %%i 2>&1
rem Show we pass through non wildcards
for /d %%i in (PASSED) do echo %%i
for /d %%i in (xxx) do (
echo %%i - Should be xxx
echo Expected second line
)
rem Show we issue no messages on failures
for /d %%i in (FAILED?) do echo %%i 2>&1
for /d %%i in (FAILED?) do (
echo %%i - Unexpected!
echo FAILED Unexpected second line
)
for /d %%i in (FAILED*) do echo %%i 2>&1
for /d %%i in (FAILED*) do (
echo %%i - Unexpected!
echo FAILED Unexpected second line
)
rem FIXME can't test wildcard expansion here since it's listed in directory
rem FIXME can't test wildcard expansion here since it's listed in directory
rem order, and not in alphabetic order.
rem order, and not in alphabetic order.
rem Proper testing would need a currently missing "sort" program implementation.
rem Proper testing would need a currently missing "sort" program implementation.
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
141e33b8
...
@@ -455,9 +455,12 @@ C
...
@@ -455,9 +455,12 @@ C
--- basic wildcards
--- basic wildcards
bazbaz
bazbaz
--- for /d
--- for /d
baz
baz@space@
foo
foo@space@
bar
bar@space@
PASSED
xxx - Should be xxx
Expected second line
--- for /L
--- for /L
1
1
3
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