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
1ee75382
Commit
1ee75382
authored
Sep 11, 2007
by
Jason Edmeades
Committed by
Alexandre Julliard
Sep 12, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd.exe: Fix redirect ordering on a command line.
parent
c7b88e95
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
6 deletions
+13
-6
batch.c
programs/cmd/batch.c
+1
-0
builtins.c
programs/cmd/builtins.c
+7
-5
directory.c
programs/cmd/directory.c
+1
-0
wcmd.h
programs/cmd/wcmd.h
+4
-1
wcmdmain.c
programs/cmd/wcmdmain.c
+0
-0
No files found.
programs/cmd/batch.c
View file @
1ee75382
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
* CMD - Wine-compatible command line interface - batch interface.
* CMD - Wine-compatible command line interface - batch interface.
*
*
* Copyright (C) 1999 D A Pickles
* Copyright (C) 1999 D A Pickles
* Copyright (C) 2007 J Edmeades
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
...
programs/cmd/builtins.c
View file @
1ee75382
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
* CMD - Wine-compatible command line interface - built-in functions.
* CMD - Wine-compatible command line interface - built-in functions.
*
*
* Copyright (C) 1999 D A Pickles
* Copyright (C) 1999 D A Pickles
* Copyright (C) 2007 J Edmeades
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
@@ -832,7 +833,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -832,7 +833,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
if
(
*
itemStart
==
'`'
||
*
itemStart
==
'\''
)
{
if
(
*
itemStart
==
'`'
||
*
itemStart
==
'\''
)
{
WCHAR
temp_path
[
MAX_PATH
],
temp_cmd
[
MAXSTRING
];
WCHAR
temp_path
[
MAX_PATH
],
temp_cmd
[
MAXSTRING
];
static
const
WCHAR
redirOut
[]
=
{
'
%'
,
's'
,
' '
,
'>'
,
'
'
,
'%'
,
's'
,
'\0'
};
static
const
WCHAR
redirOut
[]
=
{
'
>
'
,
'%'
,
's'
,
'\0'
};
static
const
WCHAR
cmdW
[]
=
{
'C'
,
'M'
,
'D'
,
'\0'
};
static
const
WCHAR
cmdW
[]
=
{
'C'
,
'M'
,
'D'
,
'\0'
};
/* Remove trailing character */
/* Remove trailing character */
...
@@ -844,7 +845,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
...
@@ -844,7 +845,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
/* Execute program and redirect output */
/* Execute program and redirect output */
wsprintf
(
temp_cmd
,
redirOut
,
(
itemStart
+
1
),
temp_file
);
wsprintf
(
temp_cmd
,
redirOut
,
(
itemStart
+
1
),
temp_file
);
WCMD_execute
(
temp_cmd
,
NULL
,
NULL
,
NULL
);
WCMD_execute
(
itemStart
,
temp_cmd
,
NULL
,
NULL
,
NULL
);
/* Open the file, read line by line and process */
/* Open the file, read line by line and process */
input
=
CreateFile
(
temp_file
,
GENERIC_READ
,
FILE_SHARE_READ
,
input
=
CreateFile
(
temp_file
,
GENERIC_READ
,
FILE_SHARE_READ
,
...
@@ -977,7 +978,7 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
...
@@ -977,7 +978,7 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
/* Process the first command, if there is one */
/* Process the first command, if there is one */
if
(
conditionTRUE
&&
firstcmd
&&
*
firstcmd
)
{
if
(
conditionTRUE
&&
firstcmd
&&
*
firstcmd
)
{
WCHAR
*
command
=
WCMD_strdupW
(
firstcmd
);
WCHAR
*
command
=
WCMD_strdupW
(
firstcmd
);
WCMD_execute
(
firstcmd
,
variable
,
value
,
cmdList
);
WCMD_execute
(
firstcmd
,
(
*
cmdList
)
->
redirects
,
variable
,
value
,
cmdList
);
free
(
command
);
free
(
command
);
}
}
...
@@ -1005,7 +1006,8 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
...
@@ -1005,7 +1006,8 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
/* Execute any appended to the statement with &&'s */
/* Execute any appended to the statement with &&'s */
if
((
*
cmdList
)
->
isAmphersand
)
{
if
((
*
cmdList
)
->
isAmphersand
)
{
if
(
processThese
)
{
if
(
processThese
)
{
WCMD_execute
((
*
cmdList
)
->
command
,
variable
,
value
,
cmdList
);
WCMD_execute
((
*
cmdList
)
->
command
,
(
*
cmdList
)
->
redirects
,
variable
,
value
,
cmdList
);
}
}
if
(
curPosition
==
*
cmdList
)
*
cmdList
=
(
*
cmdList
)
->
nextcommand
;
if
(
curPosition
==
*
cmdList
)
*
cmdList
=
(
*
cmdList
)
->
nextcommand
;
...
@@ -1033,7 +1035,7 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
...
@@ -1033,7 +1035,7 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
/* Skip leading whitespace between condition and the command */
/* Skip leading whitespace between condition and the command */
while
(
*
cmd
&&
(
*
cmd
==
' '
||
*
cmd
==
'\t'
))
cmd
++
;
while
(
*
cmd
&&
(
*
cmd
==
' '
||
*
cmd
==
'\t'
))
cmd
++
;
if
(
*
cmd
)
{
if
(
*
cmd
)
{
WCMD_execute
(
cmd
,
variable
,
value
,
cmdList
);
WCMD_execute
(
cmd
,
(
*
cmdList
)
->
redirects
,
variable
,
value
,
cmdList
);
}
}
}
}
if
(
curPosition
==
*
cmdList
)
*
cmdList
=
(
*
cmdList
)
->
nextcommand
;
if
(
curPosition
==
*
cmdList
)
*
cmdList
=
(
*
cmdList
)
->
nextcommand
;
...
...
programs/cmd/directory.c
View file @
1ee75382
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
* CMD - Wine-compatible command line interface - Directory functions.
* CMD - Wine-compatible command line interface - Directory functions.
*
*
* Copyright (C) 1999 D A Pickles
* Copyright (C) 1999 D A Pickles
* Copyright (C) 2007 J Edmeades
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
...
programs/cmd/wcmd.h
View file @
1ee75382
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
* CMD - Wine-compatible command line interface.
* CMD - Wine-compatible command line interface.
*
*
* Copyright (C) 1999 D A Pickles
* Copyright (C) 1999 D A Pickles
* Copyright (C) 2007 J Edmeades
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
@@ -32,6 +33,7 @@
...
@@ -32,6 +33,7 @@
typedef
struct
_CMD_LIST
{
typedef
struct
_CMD_LIST
{
WCHAR
*
command
;
/* Command string to execute */
WCHAR
*
command
;
/* Command string to execute */
WCHAR
*
redirects
;
/* Redirects in place */
struct
_CMD_LIST
*
nextcommand
;
/* Next command string to execute */
struct
_CMD_LIST
*
nextcommand
;
/* Next command string to execute */
BOOL
isAmphersand
;
/* Whether follows && */
BOOL
isAmphersand
;
/* Whether follows && */
int
bracketDepth
;
/* How deep bracketing have we got to */
int
bracketDepth
;
/* How deep bracketing have we got to */
...
@@ -103,7 +105,8 @@ BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars,
...
@@ -103,7 +105,8 @@ BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars,
WCHAR
*
WCMD_ReadAndParseLine
(
WCHAR
*
initialcmd
,
CMD_LIST
**
output
,
HANDLE
readFrom
);
WCHAR
*
WCMD_ReadAndParseLine
(
WCHAR
*
initialcmd
,
CMD_LIST
**
output
,
HANDLE
readFrom
);
CMD_LIST
*
WCMD_process_commands
(
CMD_LIST
*
thisCmd
,
BOOL
oneBracket
,
WCHAR
*
var
,
WCHAR
*
val
);
CMD_LIST
*
WCMD_process_commands
(
CMD_LIST
*
thisCmd
,
BOOL
oneBracket
,
WCHAR
*
var
,
WCHAR
*
val
);
void
WCMD_free_commands
(
CMD_LIST
*
cmds
);
void
WCMD_free_commands
(
CMD_LIST
*
cmds
);
void
WCMD_execute
(
WCHAR
*
orig_command
,
WCHAR
*
parameter
,
WCHAR
*
substitution
,
CMD_LIST
**
cmdList
);
void
WCMD_execute
(
WCHAR
*
orig_command
,
WCHAR
*
redirects
,
WCHAR
*
parameter
,
WCHAR
*
substitution
,
CMD_LIST
**
cmdList
);
/* Data structure to hold context when executing batch files */
/* Data structure to hold context when executing batch files */
...
...
programs/cmd/wcmdmain.c
View file @
1ee75382
This diff is collapsed.
Click to expand it.
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