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
c6eee93a
Commit
c6eee93a
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 env vars DATE, TIME, CD.
parent
93871906
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
8 deletions
+47
-8
batch.c
programs/cmd/batch.c
+47
-8
No files found.
programs/cmd/batch.c
View file @
c6eee93a
...
...
@@ -153,14 +153,6 @@ int i;
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
);
...
...
@@ -175,6 +167,53 @@ int i;
else
*
p
=
0x00
;
strcat
(
p
,
s
);
free
(
s
);
/* Handle DATE, TIME, ERRORLEVEL and CD replacements allowing */
/* override if existing env var called that name */
}
else
if
((
CompareString
(
LOCALE_USER_DEFAULT
,
NORM_IGNORECASE
|
SORT_STRINGSORT
,
(
p
+
1
),
11
,
"ERRORLEVEL%"
,
-
1
)
==
2
)
&&
(
GetEnvironmentVariable
(
"ERRORLEVEL"
,
cmd2
,
1
)
==
0
)
&&
(
GetLastError
()
==
ERROR_ENVVAR_NOT_FOUND
))
{
char
output
[
10
];
sprintf
(
output
,
"%d"
,
errorlevel
);
s
=
strdup
(
p
+
12
);
strcpy
(
p
,
output
);
strcat
(
p
,
s
);
}
else
if
((
CompareString
(
LOCALE_USER_DEFAULT
,
NORM_IGNORECASE
|
SORT_STRINGSORT
,
(
p
+
1
),
5
,
"DATE%"
,
-
1
)
==
2
)
&&
(
GetEnvironmentVariable
(
"DATE"
,
cmd2
,
1
)
==
0
)
&&
(
GetLastError
()
==
ERROR_ENVVAR_NOT_FOUND
))
{
GetDateFormat
(
LOCALE_USER_DEFAULT
,
DATE_SHORTDATE
,
NULL
,
NULL
,
cmd2
,
MAXSTRING
);
s
=
strdup
(
p
+
6
);
strcpy
(
p
,
cmd2
);
strcat
(
p
,
s
);
}
else
if
((
CompareString
(
LOCALE_USER_DEFAULT
,
NORM_IGNORECASE
|
SORT_STRINGSORT
,
(
p
+
1
),
5
,
"TIME%"
,
-
1
)
==
2
)
&&
(
GetEnvironmentVariable
(
"TIME"
,
cmd2
,
1
)
==
0
)
&&
(
GetLastError
()
==
ERROR_ENVVAR_NOT_FOUND
))
{
GetTimeFormat
(
LOCALE_USER_DEFAULT
,
TIME_NOSECONDS
,
NULL
,
NULL
,
cmd2
,
MAXSTRING
);
s
=
strdup
(
p
+
6
);
strcpy
(
p
,
cmd2
);
strcat
(
p
,
s
);
}
else
if
((
CompareString
(
LOCALE_USER_DEFAULT
,
NORM_IGNORECASE
|
SORT_STRINGSORT
,
(
p
+
1
),
3
,
"CD%"
,
-
1
)
==
2
)
&&
(
GetEnvironmentVariable
(
"CD"
,
cmd2
,
1
)
==
0
)
&&
(
GetLastError
()
==
ERROR_ENVVAR_NOT_FOUND
))
{
GetCurrentDirectory
(
MAXSTRING
,
cmd2
);
s
=
strdup
(
p
+
4
);
strcpy
(
p
,
cmd2
);
strcat
(
p
,
s
);
}
else
{
p
++
;
}
...
...
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