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
a45301cb
Commit
a45301cb
authored
Oct 23, 2012
by
Jason Edmeades
Committed by
Alexandre Julliard
Oct 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Strip quotes from for /f string before attempting to parse it.
parent
182c5459
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
10 deletions
+36
-10
builtins.c
programs/cmd/builtins.c
+11
-1
test_builtins.cmd
programs/cmd/tests/test_builtins.cmd
+11
-0
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+14
-9
No files found.
programs/cmd/builtins.c
View file @
a45301cb
...
...
@@ -2086,8 +2086,18 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
}
else
if
(
doFileset
&&
((
!
forf_usebackq
&&
*
itemStart
==
'"'
)
||
(
forf_usebackq
&&
*
itemStart
==
'\''
)))
{
/* Remove leading and trailing character, ready to parse with delims= delimiters
Note that the last quote is removed from the set and the string terminates
there to mimic windows */
WCHAR
*
strend
=
strrchrW
(
itemStart
,
forf_usebackq
?
'\''
:
'"'
);
if
(
strend
)
{
*
strend
=
0x00
;
itemStart
++
;
}
/* Copy the item away from the global buffer used by WCMD_parameter */
strcpyW
(
buffer
,
item
);
strcpyW
(
buffer
,
item
Start
);
WCMD_parse_line
(
cmdStart
,
firstCmd
,
&
cmdEnd
,
variable
,
buffer
,
&
doExecuted
,
&
forf_skip
,
forf_eol
);
...
...
programs/cmd/tests/test_builtins.cmd
View file @
a45301cb
...
...
@@ -1111,11 +1111,22 @@ set var=
echo --- for /F
mkdir foobar & cd foobar
echo ------ string argument
rem NT4 does not support usebackq
for /F %%i in ("a b c") do echo %%i
for /f usebackq %%i in ('a b c') do echo %%i>output_file
if not exist output_file (echo no output) else (type output_file & del output_file)
for /f %%i in ("a ") do echo %%i
for /f usebackq %%i in ('a ') do echo %%i>output_file
if not exist output_file (echo no output) else (type output_file & del output_file)
for /f %%i in ("a") do echo %%i
for /f usebackq %%i in ('a') do echo %%i>output_file
if not exist output_file (echo no output) else (type output_file & del output_file)
fOr /f %%i in (" a") do echo %%i
for /f usebackq %%i in (' a') do echo %%i>output_file
if not exist output_file (echo no output) else (type output_file & del output_file)
for /f %%i in (" a ") do echo %%i
for /f usebackq %%i in (' a ') do echo %%i>output_file
if not exist output_file (echo no output) else (type output_file & del output_file)
echo ------ fileset argument
echo --------- basic blank handling
echo a b c>foo
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
a45301cb
...
...
@@ -781,11 +781,16 @@ ErrorLevel 0
--- for /F
------ string argument
@todo_wine@a
@todo_wine@a
a
@todo_wine@a
@todo_wine@a
a@or_broken@no output
a
a@or_broken@no output
a
a@or_broken@no output
a
a@or_broken@no output
a
a@or_broken@no output
------ fileset argument
--------- basic blank handling
a
...
...
@@ -817,18 +822,18 @@ Passed3@or_broken@Missing functionality - Broken3
and@or_broken@Broken NT4 functionality1
Line@or_broken@Broken NT4 functionality2
Line@or_broken@Broken NT4 functionality3
@todo_wine@
ad
@todo_wine@
z@y
ad
z@y
a|d
@todo_wine@
no output
no output
@todo_wine@no output
------ delims option
@todo_wine@a
@todo_wine@a@space@
@todo_wine@a d
@todo_wine@
a
a
@todo_wine@C r
foo bar baz
@todo_wine@
foo bar baz
@todo_wine@c:\
------ skip option
c
...
...
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