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
8fbd6535
Commit
8fbd6535
authored
Sep 26, 2012
by
Jason Edmeades
Committed by
Alexandre Julliard
Oct 01, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Convert wcmd_for to use WCMD_parameter.
parent
50985fa2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
34 deletions
+25
-34
builtins.c
programs/cmd/builtins.c
+23
-32
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+2
-2
No files found.
programs/cmd/builtins.c
View file @
8fbd6535
...
...
@@ -1080,7 +1080,6 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
WCHAR
*
firstCmd
;
int
thisDepth
;
WCHAR
*
curPos
=
p
;
BOOL
expandDirs
=
FALSE
;
BOOL
useNumbers
=
FALSE
;
BOOL
doFileset
=
FALSE
;
...
...
@@ -1088,33 +1087,34 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
LONG
numbers
[
3
]
=
{
0
,
0
,
0
};
/* Defaults to 0 in native */
int
itemNum
;
CMD_LIST
*
thisCmdStart
;
int
parameterNo
=
0
;
/* Handle optional qualifiers (multiple are allowed) */
while
(
*
curPos
&&
*
curPos
==
'/'
)
{
WINE_TRACE
(
"Processing qualifier at %s
\n
"
,
wine_dbgstr_w
(
curPos
));
curPos
++
;
switch
(
toupperW
(
*
curPos
))
{
case
'D'
:
curPos
++
;
expandDirs
=
TRUE
;
break
;
case
'L'
:
curPos
++
;
useNumbers
=
TRUE
;
break
;
WCHAR
*
thisArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
);
while
(
thisArg
&&
*
thisArg
==
'/'
)
{
WINE_TRACE
(
"Processing qualifier at %s
\n
"
,
wine_dbgstr_w
(
thisArg
));
thisArg
++
;
switch
(
toupperW
(
*
thisArg
))
{
case
'D'
:
expandDirs
=
TRUE
;
break
;
case
'L'
:
useNumbers
=
TRUE
;
break
;
/* Recursive is special case - /R can have an optional path following it */
/* filenamesets are another special case - /F can have an optional options following it */
case
'R'
:
case
'F'
:
{
BOOL
isRecursive
=
(
*
curPos
==
'R'
);
BOOL
isRecursive
=
(
*
thisArg
==
'R'
);
if
(
!
isRecursive
)
doFileset
=
TRUE
;
/* Skip whitespace */
curPos
++
;
while
(
*
curPos
&&
(
*
curPos
==
' '
||
*
curPos
==
'\t'
))
curPos
++
;
/* Retrieve next parameter to see if is path/options */
thisArg
=
WCMD_parameter
(
p
,
parameterNo
,
NULL
,
NULL
,
!
isRecursive
);
/* Next parm is either qualifier, path/options or variable -
only care about it if it is the path/options */
if
(
*
curPos
&&
*
curPos
!=
'/'
&&
*
curPos
!=
'%'
)
{
if
(
thisArg
&&
*
thisArg
!=
'/'
&&
*
thisArg
!=
'%'
)
{
parameterNo
++
;
if
(
isRecursive
)
WINE_FIXME
(
"/R needs to handle supplied root
\n
"
);
else
{
static
unsigned
int
once
;
...
...
@@ -1124,38 +1124,29 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
break
;
}
default:
WINE_FIXME
(
"for qualifier '%c' unhandled
\n
"
,
*
curPos
);
curPos
++
;
WINE_FIXME
(
"for qualifier '%c' unhandled
\n
"
,
*
thisArg
);
}
/* S
kip whitespace between qualifiers
*/
while
(
*
curPos
&&
(
*
curPos
==
' '
||
*
curPos
==
'\t'
))
curPos
++
;
/* S
tep to next token
*/
thisArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
)
;
}
/* Skip whitespace before variable */
while
(
*
curPos
&&
(
*
curPos
==
' '
||
*
curPos
==
'\t'
))
curPos
++
;
/* Ensure line continues with variable */
if
(
!*
curPos
||
*
curPos
!=
'%'
)
{
if
(
!*
thisArg
||
*
thisArg
!=
'%'
)
{
WCMD_output_stderr
(
WCMD_LoadMessage
(
WCMD_SYNTAXERR
));
return
;
}
/* Variable should follow */
i
=
0
;
while
(
curPos
[
i
]
&&
curPos
[
i
]
!=
' '
&&
curPos
[
i
]
!=
'\t'
)
i
++
;
memcpy
(
&
variable
[
0
],
curPos
,
i
*
sizeof
(
WCHAR
));
variable
[
i
]
=
0x00
;
strcpyW
(
variable
,
thisArg
);
WINE_TRACE
(
"Variable identified as %s
\n
"
,
wine_dbgstr_w
(
variable
));
curPos
=
&
curPos
[
i
];
/* Skip whitespace before IN */
while
(
*
curPos
&&
(
*
curPos
==
' '
||
*
curPos
==
'\t'
))
curPos
++
;
/* Ensure line continues with IN */
if
(
!*
curPos
||
!
WCMD_keyword_ws_found
(
inW
,
sizeof
(
inW
)
/
sizeof
(
inW
[
0
]),
curPos
))
{
thisArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
);
if
(
!
thisArg
||
!
(
CompareStringW
(
LOCALE_USER_DEFAULT
,
NORM_IGNORECASE
|
SORT_STRINGSORT
,
thisArg
,
sizeof
(
inW
)
/
sizeof
(
inW
[
0
]),
inW
,
sizeof
(
inW
)
/
sizeof
(
inW
[
0
]))
==
CSTR_EQUAL
))
{
WCMD_output_stderr
(
WCMD_LoadMessage
(
WCMD_SYNTAXERR
));
return
;
}
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
8fbd6535
...
...
@@ -630,7 +630,7 @@ c
------ eol option
@todo_wine@ad
@todo_wine@z@y
@todo_wine@
a|d
a|d
@todo_wine@no output
@todo_wine@no output
------ delims option
...
...
@@ -639,7 +639,7 @@ c
@todo_wine@a d
@todo_wine@a
@todo_wine@C r
@todo_wine@
foo bar baz
foo bar baz
@todo_wine@c:\
------ skip option
@todo_wine@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