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
93871906
Commit
93871906
authored
Feb 20, 2007
by
Jason Edmeades
Committed by
Alexandre Julliard
Feb 21, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd.exe: Add support for %ERRORLEVEL% in both batch and cmd line.
parent
3bdb6414
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
batch.c
programs/cmd/batch.c
+9
-1
wcmdmain.c
programs/cmd/wcmdmain.c
+20
-1
No files found.
programs/cmd/batch.c
View file @
93871906
...
...
@@ -146,13 +146,21 @@ int i;
/* contents of fred, then the digit 1. Would need to remove */
/* ExpandEnvStrings to achieve this */
/* Replace use of %0...%9 */
/* Replace use of %0...%9
and errorlevel
*/
p
=
cmd1
;
while
((
p
=
strchr
(
p
,
'%'
)))
{
i
=
*
(
p
+
1
)
-
'0'
;
if
(
*
(
p
+
1
)
==
'~'
)
{
WCMD_HandleTildaModifiers
(
&
p
,
NULL
);
p
++
;
}
else
if
(
CompareString
(
LOCALE_USER_DEFAULT
,
NORM_IGNORECASE
|
SORT_STRINGSORT
,
(
p
+
1
),
11
,
"ERRORLEVEL%"
,
-
1
)
==
2
)
{
char
output
[
10
];
sprintf
(
output
,
"%d"
,
errorlevel
);
s
=
strdup
(
p
+
12
);
strcpy
(
p
,
output
);
strcat
(
p
,
s
);
}
else
if
((
i
>=
0
)
&&
(
i
<=
9
))
{
s
=
strdup
(
p
+
2
);
t
=
WCMD_parameter
(
context
->
command
,
i
+
context
->
shift_count
,
NULL
);
...
...
programs/cmd/wcmdmain.c
View file @
93871906
...
...
@@ -301,7 +301,7 @@ int main (int argc, char *argv[])
void
WCMD_process_command
(
char
*
command
)
{
char
*
cmd
,
*
p
;
char
*
cmd
,
*
p
,
*
s
;
int
status
,
i
,
len
;
DWORD
count
,
creationDisposition
;
HANDLE
h
;
...
...
@@ -309,6 +309,25 @@ void WCMD_process_command (char *command)
SECURITY_ATTRIBUTES
sa
;
/*
* Replace errorlevel with current value (This shrinks in
* place and hence no need to reallocate the memory yet)
*/
p
=
command
;
while
((
p
=
strchr
(
p
,
'%'
)))
{
if
(
CompareString
(
LOCALE_USER_DEFAULT
,
NORM_IGNORECASE
|
SORT_STRINGSORT
,
(
p
+
1
),
11
,
"ERRORLEVEL%"
,
-
1
)
==
2
)
{
char
output
[
10
];
sprintf
(
output
,
"%d"
,
errorlevel
);
s
=
strdup
(
p
+
12
);
strcpy
(
p
,
output
);
strcat
(
p
,
s
);
}
else
{
p
++
;
}
}
/*
* Expand up environment variables.
*/
len
=
ExpandEnvironmentStrings
(
command
,
NULL
,
0
);
...
...
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