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
612dc9d3
Commit
612dc9d3
authored
Mar 08, 2007
by
Jason Edmeades
Committed by
Alexandre Julliard
Mar 08, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd.exe: Support SHIFT /n option.
parent
ffbaedef
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
8 deletions
+29
-8
batch.c
programs/cmd/batch.c
+2
-2
builtins.c
programs/cmd/builtins.c
+23
-2
wcmd.h
programs/cmd/wcmd.h
+2
-2
wcmdmain.c
programs/cmd/wcmdmain.c
+2
-2
No files found.
programs/cmd/batch.c
View file @
612dc9d3
...
...
@@ -89,7 +89,7 @@ void WCMD_batch (char *file, char *command, int called, char *startLabel, HANDLE
context
=
(
BATCH_CONTEXT
*
)
LocalAlloc
(
LMEM_FIXED
,
sizeof
(
BATCH_CONTEXT
));
context
->
h
=
h
;
context
->
command
=
command
;
context
->
shift_count
=
0
;
memset
(
context
->
shift_count
,
0x00
,
sizeof
(
context
->
shift_count
))
;
context
->
prev_context
=
prev_context
;
context
->
skip_rest
=
FALSE
;
...
...
@@ -386,7 +386,7 @@ void WCMD_HandleTildaModifiers(char **start, char *forVariable) {
/* Extract the parameter to play with */
if
((
*
lastModifier
>=
'0'
&&
*
lastModifier
<=
'9'
))
{
strcpy
(
outputparam
,
WCMD_parameter
(
context
->
command
,
*
lastModifier
-
'0'
+
context
->
shift_count
,
NULL
));
*
lastModifier
-
'0'
+
context
->
shift_count
[
*
lastModifier
-
'0'
]
,
NULL
));
}
else
{
/* FIXME: Retrieve 'for' variable %c\n", *lastModifier); */
/* Need to get 'for' loop variable into outputparam */
...
...
programs/cmd/builtins.c
View file @
612dc9d3
...
...
@@ -1388,11 +1388,32 @@ void WCMD_setshow_time (void) {
* WCMD_shift
*
* Shift batch parameters.
* Optional /n says where to start shifting (n=0-8)
*/
void
WCMD_shift
(
void
)
{
void
WCMD_shift
(
char
*
command
)
{
int
start
;
if
(
context
!=
NULL
)
context
->
shift_count
++
;
if
(
context
!=
NULL
)
{
char
*
pos
=
strchr
(
command
,
'/'
);
int
i
;
if
(
pos
==
NULL
)
{
start
=
0
;
}
else
if
(
*
(
pos
+
1
)
>=
'0'
&&
*
(
pos
+
1
)
<=
'8'
)
{
start
=
(
*
(
pos
+
1
)
-
'0'
);
}
else
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
WCMD_print_error
();
return
;
}
WINE_TRACE
(
"Shifting variables, starting at %d
\n
"
,
start
);
for
(
i
=
start
;
i
<=
8
;
i
++
)
{
context
->
shift_count
[
i
]
=
context
->
shift_count
[
i
+
1
]
+
1
;
}
context
->
shift_count
[
9
]
=
context
->
shift_count
[
9
]
+
1
;
}
}
...
...
programs/cmd/wcmd.h
View file @
612dc9d3
...
...
@@ -68,7 +68,7 @@ void WCMD_setshow_env (char *command);
void
WCMD_setshow_path
(
char
*
command
);
void
WCMD_setshow_prompt
(
void
);
void
WCMD_setshow_time
(
void
);
void
WCMD_shift
(
voi
d
);
void
WCMD_shift
(
char
*
comman
d
);
void
WCMD_show_prompt
(
void
);
void
WCMD_title
(
char
*
);
void
WCMD_type
(
void
);
...
...
@@ -91,7 +91,7 @@ void WCMD_splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ex
typedef
struct
{
char
*
command
;
/* The command which invoked the batch file */
HANDLE
h
;
/* Handle to the open batch file */
int
shift_count
;
/* Number of SHIFT commands executed
*/
int
shift_count
[
10
];
/* Offset in terms of shifts for %0 - %9
*/
void
*
prev_context
;
/* Pointer to the previous context block */
BOOL
skip_rest
;
/* Skip the rest of the batch program and exit */
}
BATCH_CONTEXT
;
...
...
programs/cmd/wcmdmain.c
View file @
612dc9d3
...
...
@@ -411,7 +411,7 @@ void WCMD_process_command (char *command)
/* Replace use of %0...%9 if in batch program*/
}
else
if
(
context
&&
(
i
>=
0
)
&&
(
i
<=
9
))
{
s
=
strdup
(
p
+
2
);
t
=
WCMD_parameter
(
context
->
command
,
i
+
context
->
shift_count
,
NULL
);
t
=
WCMD_parameter
(
context
->
command
,
i
+
context
->
shift_count
[
i
]
,
NULL
);
strcpy
(
p
,
t
);
strcat
(
p
,
s
);
free
(
s
);
...
...
@@ -629,7 +629,7 @@ void WCMD_process_command (char *command)
WCMD_setshow_env
(
p
);
break
;
case
WCMD_SHIFT
:
WCMD_shift
();
WCMD_shift
(
p
);
break
;
case
WCMD_TIME
:
WCMD_setshow_time
();
...
...
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