Commit 84f02a6a authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

cmd.exe: Fix pipes.

parent 52e8f6f6
...@@ -998,13 +998,15 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable, ...@@ -998,13 +998,15 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
/* execute all appropriate commands */ /* execute all appropriate commands */
curPosition = *cmdList; curPosition = *cmdList;
WINE_TRACE("Processing cmdList(%p) - &(%d) bd(%d / %d)\n", WINE_TRACE("Processing cmdList(%p) - delim(%d) bd(%d / %d)\n",
*cmdList, *cmdList,
(*cmdList)->isAmphersand, (*cmdList)->prevDelim,
(*cmdList)->bracketDepth, myDepth); (*cmdList)->bracketDepth, myDepth);
/* Execute any appended to the statement with &&'s */ /* Execute any statements appended to the line */
if ((*cmdList)->isAmphersand) { /* FIXME: Only if previous call worked for && or failed for || */
if ((*cmdList)->prevDelim == CMD_ONFAILURE ||
(*cmdList)->prevDelim != CMD_ONSUCCESS) {
if (processThese) { if (processThese) {
WCMD_execute ((*cmdList)->command, (*cmdList)->redirects, variable, WCMD_execute ((*cmdList)->command, (*cmdList)->redirects, variable,
value, cmdList); value, cmdList);
...@@ -2278,6 +2280,7 @@ void WCMD_more (WCHAR *command) { ...@@ -2278,6 +2280,7 @@ void WCMD_more (WCHAR *command) {
HANDLE hConIn = CreateFile(conInW, GENERIC_READ | GENERIC_WRITE, HANDLE hConIn = CreateFile(conInW, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0); FILE_ATTRIBUTE_NORMAL, 0);
WINE_TRACE("No parms - working probably in pipe mode\n");
SetStdHandle(STD_INPUT_HANDLE, hConIn); SetStdHandle(STD_INPUT_HANDLE, hConIn);
/* Warning: No easy way of ending the stream (ctrl+z on windows) so /* Warning: No easy way of ending the stream (ctrl+z on windows) so
...@@ -2302,6 +2305,7 @@ void WCMD_more (WCHAR *command) { ...@@ -2302,6 +2305,7 @@ void WCMD_more (WCHAR *command) {
BOOL needsPause = FALSE; BOOL needsPause = FALSE;
/* Loop through all args */ /* Loop through all args */
WINE_TRACE("Parms supplied - working through each file\n");
WCMD_enter_paged_mode(moreStrPage); WCMD_enter_paged_mode(moreStrPage);
while (argN) { while (argN) {
......
...@@ -31,12 +31,20 @@ ...@@ -31,12 +31,20 @@
/* Data structure to hold commands to be processed */ /* Data structure to hold commands to be processed */
typedef enum _CMDdelimiters {
CMD_NONE, /* End of line or single & */
CMD_ONFAILURE, /* || */
CMD_ONSUCCESS, /* && */
CMD_PIPE /* Single */
} CMD_DELIMITERS;
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 */ 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 && */ CMD_DELIMITERS prevDelim; /* Previous delimiter */
int bracketDepth;/* How deep bracketing have we got to */ int bracketDepth;/* How deep bracketing have we got to */
WCHAR pipeFile[MAX_PATH]; /* Where to get input from for pipes */
} CMD_LIST; } CMD_LIST;
void WCMD_assoc (WCHAR *, BOOL); void WCMD_assoc (WCHAR *, BOOL);
...@@ -64,7 +72,6 @@ void WCMD_output (const WCHAR *format, ...); ...@@ -64,7 +72,6 @@ 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 (CMD_LIST **command, WCHAR *var, WCHAR *val);
void WCMD_popd (void); void WCMD_popd (void);
void WCMD_print_error (void); void WCMD_print_error (void);
void WCMD_pushd (WCHAR *); void WCMD_pushd (WCHAR *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment