Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olivier F. R. Dierick
wine
Commits
8fbd6535
Commit
8fbd6535
authored
12 years ago
by
Jason Edmeades
Committed by
Alexandre Julliard
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cmd: Convert wcmd_for to use WCMD_parameter.
parent
50985fa2
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
programs/cmd/builtins.c
+23
-32
23 additions, 32 deletions
programs/cmd/builtins.c
programs/cmd/tests/test_builtins.cmd.exp
+2
-2
2 additions, 2 deletions
programs/cmd/tests/test_builtins.cmd.exp
with
25 additions
and
34 deletions
programs/cmd/builtins.c
+
23
−
32
View file @
8fbd6535
...
@@ -1080,7 +1080,6 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -1080,7 +1080,6 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
WCHAR
*
firstCmd
;
WCHAR
*
firstCmd
;
int
thisDepth
;
int
thisDepth
;
WCHAR
*
curPos
=
p
;
BOOL
expandDirs
=
FALSE
;
BOOL
expandDirs
=
FALSE
;
BOOL
useNumbers
=
FALSE
;
BOOL
useNumbers
=
FALSE
;
BOOL
doFileset
=
FALSE
;
BOOL
doFileset
=
FALSE
;
...
@@ -1088,33 +1087,34 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -1088,33 +1087,34 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
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
;
int
parameterNo
=
0
;
/* Handle optional qualifiers (multiple are allowed) */
/* Handle optional qualifiers (multiple are allowed) */
while
(
*
curPos
&&
*
curPos
==
'/'
)
{
WCHAR
*
thisArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
);
WINE_TRACE
(
"Processing qualifier at %s
\n
"
,
wine_dbgstr_w
(
curPos
));
while
(
thisArg
&&
*
thisArg
==
'/'
)
{
curPos
++
;
WINE_TRACE
(
"Processing qualifier at %s
\n
"
,
wine_dbgstr_w
(
thisArg
));
switch
(
toupperW
(
*
curPos
))
{
thisArg
++
;
case
'D'
:
curPos
++
;
expandDirs
=
TRUE
;
break
;
switch
(
toupperW
(
*
thisArg
))
{
case
'L'
:
curPos
++
;
useNumbers
=
TRUE
;
break
;
case
'D'
:
expandDirs
=
TRUE
;
break
;
case
'L'
:
useNumbers
=
TRUE
;
break
;
/* Recursive is special case - /R can have an optional path following it */
/* 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 */
/* filenamesets are another special case - /F can have an optional options following it */
case
'R'
:
case
'R'
:
case
'F'
:
case
'F'
:
{
{
BOOL
isRecursive
=
(
*
curPos
==
'R'
);
BOOL
isRecursive
=
(
*
thisArg
==
'R'
);
if
(
!
isRecursive
)
if
(
!
isRecursive
)
doFileset
=
TRUE
;
doFileset
=
TRUE
;
/* Skip whitespace */
/* Retrieve next parameter to see if is path/options */
curPos
++
;
thisArg
=
WCMD_parameter
(
p
,
parameterNo
,
NULL
,
NULL
,
!
isRecursive
);
while
(
*
curPos
&&
(
*
curPos
==
' '
||
*
curPos
==
'\t'
))
curPos
++
;
/* Next parm is either qualifier, path/options or variable -
/* Next parm is either qualifier, path/options or variable -
only care about it if it is the path/options */
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
"
);
if
(
isRecursive
)
WINE_FIXME
(
"/R needs to handle supplied root
\n
"
);
else
{
else
{
static
unsigned
int
once
;
static
unsigned
int
once
;
...
@@ -1124,38 +1124,29 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -1124,38 +1124,29 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
break
;
break
;
}
}
default:
default:
WINE_FIXME
(
"for qualifier '%c' unhandled
\n
"
,
*
curPos
);
WINE_FIXME
(
"for qualifier '%c' unhandled
\n
"
,
*
thisArg
);
curPos
++
;
}
}
/* S
kip whitespace between qualifiers
*/
/* S
tep to next token
*/
w
hi
le
(
*
curPos
&&
(
*
curPos
==
' '
||
*
curPos
==
'\t'
))
curPos
++
;
t
hi
sArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
)
;
}
}
/* Skip whitespace before variable */
while
(
*
curPos
&&
(
*
curPos
==
' '
||
*
curPos
==
'\t'
))
curPos
++
;
/* Ensure line continues with variable */
/* Ensure line continues with variable */
if
(
!*
curPos
||
*
curPos
!=
'%'
)
{
if
(
!*
thisArg
||
*
thisArg
!=
'%'
)
{
WCMD_output_stderr
(
WCMD_LoadMessage
(
WCMD_SYNTAXERR
));
WCMD_output_stderr
(
WCMD_LoadMessage
(
WCMD_SYNTAXERR
));
return
;
return
;
}
}
/* Variable should follow */
/* Variable should follow */
i
=
0
;
strcpyW
(
variable
,
thisArg
);
while
(
curPos
[
i
]
&&
curPos
[
i
]
!=
' '
&&
curPos
[
i
]
!=
'\t'
)
i
++
;
memcpy
(
&
variable
[
0
],
curPos
,
i
*
sizeof
(
WCHAR
));
variable
[
i
]
=
0x00
;
WINE_TRACE
(
"Variable identified as %s
\n
"
,
wine_dbgstr_w
(
variable
));
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 */
/* Ensure line continues with IN */
if
(
!*
curPos
thisArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
);
||
!
WCMD_keyword_ws_found
(
inW
,
sizeof
(
inW
)
/
sizeof
(
inW
[
0
]),
curPos
))
{
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
));
WCMD_output_stderr
(
WCMD_LoadMessage
(
WCMD_SYNTAXERR
));
return
;
return
;
}
}
...
...
This diff is collapsed.
Click to expand it.
programs/cmd/tests/test_builtins.cmd.exp
+
2
−
2
View file @
8fbd6535
...
@@ -630,7 +630,7 @@ c
...
@@ -630,7 +630,7 @@ c
------ eol option
------ eol option
@todo_wine@ad
@todo_wine@ad
@todo_wine@z@y
@todo_wine@z@y
@todo_wine@
a|d
a|d
@todo_wine@no output
@todo_wine@no output
@todo_wine@no output
@todo_wine@no output
------ delims option
------ delims option
...
@@ -639,7 +639,7 @@ c
...
@@ -639,7 +639,7 @@ c
@todo_wine@a d
@todo_wine@a d
@todo_wine@a
@todo_wine@a
@todo_wine@C r
@todo_wine@C r
@todo_wine@
foo bar baz
foo bar baz
@todo_wine@c:\
@todo_wine@c:\
------ skip option
------ skip option
@todo_wine@c
@todo_wine@c
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment