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
293da2d0
Commit
293da2d0
authored
Oct 22, 2012
by
Jason Edmeades
Committed by
Alexandre Julliard
Oct 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Implement support for for /f eol=c option.
parent
a3688948
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
10 deletions
+26
-10
builtins.c
programs/cmd/builtins.c
+12
-10
test_builtins.cmd
programs/cmd/tests/test_builtins.cmd
+11
-0
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+3
-0
No files found.
programs/cmd/builtins.c
View file @
293da2d0
...
...
@@ -1565,7 +1565,7 @@ static BOOL WCMD_parse_forf_options(WCHAR *options, WCHAR *eol, int *skip,
eolW
,
sizeof
(
eolW
)
/
sizeof
(
WCHAR
))
==
CSTR_EQUAL
)
{
*
eol
=
*
(
pos
+
sizeof
(
eolW
)
/
sizeof
(
WCHAR
));
pos
=
pos
+
sizeof
(
eolW
)
/
sizeof
(
WCHAR
)
+
1
;
WINE_
FIXM
E
(
"Found eol as %c(%x)
\n
"
,
*
eol
,
*
eol
);
WINE_
TRAC
E
(
"Found eol as %c(%x)
\n
"
,
*
eol
,
*
eol
);
/* Save number of lines to skip (Can be in base 10, hex (0x...) or octal (0xx) */
}
else
if
(
CompareStringW
(
LOCALE_USER_DEFAULT
,
NORM_IGNORECASE
|
SORT_STRINGSORT
,
...
...
@@ -1680,7 +1680,7 @@ static void WCMD_add_dirstowalk(DIRECTORY_STACK *dirsToWalk) {
* WCMD_parse_line
*
* When parsing file or string contents (for /f), once the string to parse
* has
e
been identified, handle the various options and call the do part
* has been identified, handle the various options and call the do part
* if appropriate.
*
* Parameters:
...
...
@@ -1693,14 +1693,16 @@ static void WCMD_add_dirstowalk(DIRECTORY_STACK *dirsToWalk) {
* buffer [I] - The string to parse
* doExecuted [O] - Set to TRUE if the DO is ever executed once
* forf_skip [I/O] - How many lines to skip first
* forf_eol [I] - The 'end of line' (comment) character
*/
static
void
WCMD_parse_line
(
CMD_LIST
*
cmdStart
,
static
void
WCMD_parse_line
(
CMD_LIST
*
cmdStart
,
const
WCHAR
*
firstCmd
,
CMD_LIST
**
cmdEnd
,
CMD_LIST
**
cmdEnd
,
const
WCHAR
*
variable
,
WCHAR
*
buffer
,
BOOL
*
doExecuted
,
int
*
forf_skip
)
{
WCHAR
*
buffer
,
BOOL
*
doExecuted
,
int
*
forf_skip
,
WCHAR
forf_eol
)
{
WCHAR
*
parm
,
*
where
;
...
...
@@ -1715,7 +1717,7 @@ static void WCMD_parse_line(CMD_LIST *cmdStart,
WINE_TRACE
(
"Parsed parameter: %s from %s
\n
"
,
wine_dbgstr_w
(
parm
),
wine_dbgstr_w
(
buffer
));
if
(
where
)
{
if
(
where
&&
where
[
0
]
!=
forf_eol
)
{
CMD_LIST
*
thisCmdStart
=
cmdStart
;
*
doExecuted
=
TRUE
;
WCMD_part_execute
(
&
thisCmdStart
,
firstCmd
,
variable
,
parm
,
FALSE
,
TRUE
);
...
...
@@ -2022,7 +2024,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
while
(
WCMD_fgets
(
buffer
,
sizeof
(
buffer
)
/
sizeof
(
WCHAR
),
input
))
{
WCMD_parse_line
(
cmdStart
,
firstCmd
,
&
cmdEnd
,
variable
,
buffer
,
&
doExecuted
,
&
forf_skip
);
&
forf_skip
,
forf_eol
);
buffer
[
0
]
=
0
;
}
CloseHandle
(
input
);
...
...
@@ -2039,7 +2041,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
/* Copy the item away from the global buffer used by WCMD_parameter */
strcpyW
(
buffer
,
item
);
WCMD_parse_line
(
cmdStart
,
firstCmd
,
&
cmdEnd
,
variable
,
buffer
,
&
doExecuted
,
&
forf_skip
);
&
forf_skip
,
forf_eol
);
}
WINE_TRACE
(
"Post-command, cmdEnd = %p
\n
"
,
cmdEnd
);
...
...
programs/cmd/tests/test_builtins.cmd
View file @
293da2d0
...
...
@@ -1155,6 +1155,17 @@ rem for a simple todo_wine test
rem (for /f "usebackq" %%i in (`echo z a b`) do echo %%i) || echo not supported
rem (for /f usebackq %%i in (`echo z a b`) do echo %%i) || echo not supported
echo ------ eol option
if "%CD%"=="" goto :SkipFORFeolNT4
echo Line one>foo
echo and Line two>>foo
echo Line three>>foo
for /f "eol=L" %%i in (foo) do echo %%i
for /f "eol=a" %%i in (foo) do echo %%i
del foo
goto :ContinueFORFeol
:SkipFORFeolNT4
for /l %%i in (1,1,3) do echo Broken NT4 functionality%%i
:ContinueFORFeol
for /f "eol=@" %%i in (" ad") do echo %%i
for /f "eol=@" %%i in (" z@y") do echo %%i
for /f "eol=|" %%i in ("a|d") do echo %%i
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
293da2d0
...
...
@@ -810,6 +810,9 @@ a
b
c
------ eol option
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
a|d
...
...
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