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
a5b1172e
Commit
a5b1172e
authored
Jun 04, 2013
by
Jason Edmeades
Committed by
Alexandre Julliard
Jun 05, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Fix 'for' expansion of wildcards when no args are supplied.
parent
56a33a8c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
3 deletions
+34
-3
builtins.c
programs/cmd/builtins.c
+6
-2
test_builtins.cmd
programs/cmd/tests/test_builtins.cmd
+16
-1
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+12
-0
No files found.
programs/cmd/builtins.c
View file @
a5b1172e
...
...
@@ -2237,6 +2237,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
if
(
!
useNumbers
&&
!
doFileset
)
{
WCHAR
fullitem
[
MAX_PATH
];
int
prefixlen
=
0
;
/* Now build the item to use / search for in the specified directory,
as it is fully qualified in the /R case */
...
...
@@ -2245,11 +2246,12 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
strcatW
(
fullitem
,
slashW
);
strcatW
(
fullitem
,
item
);
}
else
{
WCHAR
*
prefix
=
strrchrW
(
item
,
'\\'
);
if
(
prefix
)
prefixlen
=
(
prefix
-
item
)
+
1
;
strcpyW
(
fullitem
,
item
);
}
if
(
strpbrkW
(
fullitem
,
wildcards
))
{
hff
=
FindFirstFileW
(
fullitem
,
&
fd
);
if
(
hff
!=
INVALID_HANDLE_VALUE
)
{
do
{
...
...
@@ -2270,7 +2272,9 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
strcatW
(
fullitem
,
slashW
);
strcatW
(
fullitem
,
fd
.
cFileName
);
}
else
{
strcpyW
(
fullitem
,
fd
.
cFileName
);
if
(
prefixlen
)
lstrcpynW
(
fullitem
,
item
,
prefixlen
+
1
);
fullitem
[
prefixlen
]
=
0x00
;
strcatW
(
fullitem
,
fd
.
cFileName
);
}
doExecuted
=
TRUE
;
...
...
programs/cmd/tests/test_builtins.cmd
View file @
a5b1172e
...
...
@@ -1017,7 +1017,22 @@ for /R %%i in (baz* fred* jim) do call temp.bat %%i
call :ValidateExpected
echo for /R passed
cd .. & rd /s/Q foobar
echo --- Complex wildcards unix and windows slash
cd ..
echo Windows slashs, valid path
for %%f in (foobar\baz\bazbaz) do echo ASIS: %%f
for %%f in (foobar\baz\*) do echo WC : %%f
echo Windows slashs, invalid path
for %%f in (foobar\jim\bazbaz) do echo ASIS: %%f
for %%f in (foobar\jim\*) do echo WC : %%f
echo Unix slashs, valid path
for %%f in (foobar/baz/bazbaz) do echo ASIS: %%f
for %%f in (foobar/baz/*) do echo WC : %%f
echo Unix slashs, invalid path
for %%f in (foobar/jim/bazbaz) do echo ASIS: %%f
for %%f in (foobar/jim/*) do echo WC : %%f
echo Done
rd /s/Q foobar
echo --- for /L
rem Some cases loop forever writing 0s, like e.g. (1,0,1), (1,a,3) or (a,b,c); those can't be tested here
for /L %%i in (1,2,0) do echo %%i
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
a5b1172e
...
...
@@ -691,6 +691,18 @@ Mixed enumeration from provided root
With duplicates enumeration
Strip missing wildcards, keep unwildcarded names
for /R passed
--- Complex wildcards unix and windows slash
Windows slashs, valid path
ASIS: foobar\baz\bazbaz
WC : foobar\baz\bazbaz
Windows slashs, invalid path
ASIS: foobar\jim\bazbaz
Unix slashs, valid path
ASIS: foobar/baz/bazbaz
WC : bazbaz
Unix slashs, invalid path
ASIS: foobar/jim/bazbaz
Done
--- for /L
1
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