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
7b9af226
Commit
7b9af226
authored
Sep 06, 2011
by
Frédéric Delanoy
Committed by
Alexandre Julliard
Sep 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Simplify WCMD_parameter function.
parent
40c6ff8a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
45 deletions
+23
-45
batch.c
programs/cmd/batch.c
+23
-45
No files found.
programs/cmd/batch.c
View file @
7b9af226
...
...
@@ -138,58 +138,36 @@ void WCMD_batch (WCHAR *file, WCHAR *command, int called, WCHAR *startLabel, HAN
*/
WCHAR
*
WCMD_parameter
(
WCHAR
*
s
,
int
n
,
WCHAR
**
where
)
{
int
i
=
0
;
int
curParamNb
=
0
;
static
WCHAR
param
[
MAX_PATH
];
WCHAR
*
p
;
WCHAR
*
p
=
s
,
*
q
;
BOOL
quotesDelimited
;
if
(
where
!=
NULL
)
*
where
=
NULL
;
p
=
param
;
while
(
TRUE
)
{
switch
(
*
s
)
{
case
' '
:
/* Skip leading spaces */
case
'\t'
:
/* Treat tabs as spaces */
s
++
;
break
;
case
'"'
:
if
(
where
!=
NULL
&&
i
==
n
)
*
where
=
s
;
s
++
;
while
((
*
s
!=
'\0'
)
&&
(
*
s
!=
'"'
))
{
*
p
++
=
*
s
++
;
}
if
(
i
==
n
)
{
*
p
=
'\0'
;
return
param
;
}
if
(
*
s
==
'"'
)
s
++
;
param
[
0
]
=
'\0'
;
i
++
;
p
=
param
;
break
;
/* The code to handle bracketed parms is removed because it should no longer
be necessary after the multiline support has been added and the for loop
set of data is now parseable individually. */
case
'\0'
:
return
param
;
default:
/* Only return where if it is for the right parameter */
if
(
where
!=
NULL
&&
i
==
n
)
*
where
=
s
;
while
((
*
s
!=
'\0'
)
&&
(
*
s
!=
' '
)
&&
(
*
s
!=
','
)
&&
(
*
s
!=
'='
)
&&
(
*
s
!=
'\t'
))
{
*
p
++
=
*
s
++
;
}
if
(
i
==
n
&&
(
p
!=
param
))
{
*
p
=
'\0'
;
return
param
;
}
/* Skip double delimiters, eg. dir a.a,,,,,b.b */
if
(
p
!=
param
)
{
param
[
0
]
=
'\0'
;
i
++
;
while
(
TRUE
)
{
while
(
*
p
&&
((
*
p
==
' '
)
||
(
*
p
==
','
)
||
(
*
p
==
'='
)
||
(
*
p
==
'\t'
)))
p
++
;
if
(
*
p
==
'\0'
)
return
param
;
quotesDelimited
=
(
*
p
==
'"'
);
if
(
where
!=
NULL
&&
curParamNb
==
n
)
*
where
=
p
;
if
(
quotesDelimited
)
{
q
=
++
p
;
while
(
*
p
&&
*
p
!=
'"'
)
p
++
;
}
else
{
s
++
;
/* Skip delimiter */
q
=
p
;
while
(
*
p
&&
(
*
p
!=
' '
)
&&
(
*
p
!=
','
)
&&
(
*
p
!=
'='
)
&&
(
*
p
!=
'\t'
))
p
++
;
}
p
=
param
;
if
(
curParamNb
==
n
)
{
memcpy
(
param
,
q
,
(
p
-
q
)
*
sizeof
(
WCHAR
));
param
[
p
-
q
]
=
'\0'
;
return
param
;
}
if
(
quotesDelimited
&&
*
p
==
'"'
)
p
++
;
curParamNb
++
;
}
}
...
...
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