cmd.exe: Pass command structure into WCMD_pipe, not command line itself.

This commit is contained in:
Jason Edmeades 2007-06-15 20:59:20 +01:00 committed by Alexandre Julliard
parent a88a6c802a
commit aad1d8ce24
2 changed files with 13 additions and 12 deletions

View File

@ -28,6 +28,15 @@
#include <ctype.h> #include <ctype.h>
#include <wine/unicode.h> #include <wine/unicode.h>
/* Data structure to hold commands to be processed */
typedef struct _CMD_LIST {
WCHAR *command; /* Command string to execute */
struct _CMD_LIST *nextcommand; /* Next command string to execute */
BOOL isAmphersand;/* Whether follows && */
int bracketDepth;/* How deep bracketing have we got to */
} CMD_LIST;
void WCMD_assoc (WCHAR *, BOOL); void WCMD_assoc (WCHAR *, BOOL);
void WCMD_batch (WCHAR *, WCHAR *, int, WCHAR *, HANDLE); void WCMD_batch (WCHAR *, WCHAR *, int, WCHAR *, HANDLE);
void WCMD_call (WCHAR *command); void WCMD_call (WCHAR *command);
@ -53,7 +62,7 @@ void WCMD_output (const WCHAR *format, ...);
void WCMD_output_asis (const WCHAR *message); void WCMD_output_asis (const WCHAR *message);
void WCMD_parse (WCHAR *s, WCHAR *q, WCHAR *p1, WCHAR *p2); void WCMD_parse (WCHAR *s, WCHAR *q, WCHAR *p1, WCHAR *p2);
void WCMD_pause (void); void WCMD_pause (void);
void WCMD_pipe (WCHAR *command); void WCMD_pipe (CMD_LIST **command);
void WCMD_popd (void); void WCMD_popd (void);
void WCMD_print_error (void); void WCMD_print_error (void);
void WCMD_process_command (WCHAR *command); void WCMD_process_command (WCHAR *command);
@ -92,15 +101,6 @@ WCHAR *WCMD_strdupW(WCHAR *input);
BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars, BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars,
LPDWORD charsRead, const LPOVERLAPPED unused); LPDWORD charsRead, const LPOVERLAPPED unused);
/* Data structure to hold commands to be processed */
typedef struct _CMD_LIST {
WCHAR *command; /* Command string to execute */
struct _CMD_LIST *nextcommand; /* Next command string to execute */
BOOL isAmphersand;/* Whether follows && */
int bracketDepth;/* How deep bracketing have we got to */
} CMD_LIST;
WCHAR *WCMD_ReadAndParseLine(WCHAR *initialcmd, CMD_LIST **output, HANDLE readFrom); WCHAR *WCMD_ReadAndParseLine(WCHAR *initialcmd, CMD_LIST **output, HANDLE readFrom);
void WCMD_process_commands(CMD_LIST *thisCmd); void WCMD_process_commands(CMD_LIST *thisCmd);
void WCMD_free_commands(CMD_LIST *cmds); void WCMD_free_commands(CMD_LIST *cmds);

View File

@ -1487,9 +1487,10 @@ void WCMD_opt_s_strip_quotes(WCHAR *cmd) {
* Handle pipes within a command - the DOS way using temporary files. * Handle pipes within a command - the DOS way using temporary files.
*/ */
void WCMD_pipe (WCHAR *command) { void WCMD_pipe (CMD_LIST **cmdEntry) {
WCHAR *p; WCHAR *p;
WCHAR *command = (*cmdEntry)->command;
WCHAR temp_path[MAX_PATH], temp_file[MAX_PATH], temp_file2[MAX_PATH], temp_cmd[1024]; WCHAR temp_path[MAX_PATH], temp_file[MAX_PATH], temp_file2[MAX_PATH], temp_cmd[1024];
static const WCHAR redirOut[] = {'%','s',' ','>',' ','%','s','\0'}; static const WCHAR redirOut[] = {'%','s',' ','>',' ','%','s','\0'};
static const WCHAR redirIn[] = {'%','s',' ','<',' ','%','s','\0'}; static const WCHAR redirIn[] = {'%','s',' ','<',' ','%','s','\0'};
@ -2077,7 +2078,7 @@ void WCMD_process_commands(CMD_LIST *thisCmd) {
if (thisCmd->command && thisCmd->command[0] != ':') { if (thisCmd->command && thisCmd->command[0] != ':') {
WINE_TRACE("Executing command: '%s'\n", wine_dbgstr_w(thisCmd->command)); WINE_TRACE("Executing command: '%s'\n", wine_dbgstr_w(thisCmd->command));
if (strchrW(thisCmd->command,'|') != NULL) { if (strchrW(thisCmd->command,'|') != NULL) {
WCMD_pipe (thisCmd->command); WCMD_pipe (&thisCmd);
} else { } else {
WCMD_process_command (thisCmd->command); WCMD_process_command (thisCmd->command);
} }