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,
/* execute all appropriate commands */
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)->isAmphersand,
(*cmdList)->prevDelim,
(*cmdList)->bracketDepth, myDepth);
/* Execute any appended to the statement with &&'s */
if ((*cmdList)->isAmphersand) {
/* Execute any statements appended to the line */
/* FIXME: Only if previous call worked for && or failed for || */
if ((*cmdList)->prevDelim == CMD_ONFAILURE ||
(*cmdList)->prevDelim != CMD_ONSUCCESS) {
if (processThese) {
WCMD_execute ((*cmdList)->command, (*cmdList)->redirects, variable,
value, cmdList);
......@@ -2278,6 +2280,7 @@ void WCMD_more (WCHAR *command) {
HANDLE hConIn = CreateFile(conInW, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
WINE_TRACE("No parms - working probably in pipe mode\n");
SetStdHandle(STD_INPUT_HANDLE, hConIn);
/* Warning: No easy way of ending the stream (ctrl+z on windows) so
......@@ -2302,6 +2305,7 @@ void WCMD_more (WCHAR *command) {
BOOL needsPause = FALSE;
/* Loop through all args */
WINE_TRACE("Parms supplied - working through each file\n");
WCMD_enter_paged_mode(moreStrPage);
while (argN) {
......
......@@ -31,12 +31,20 @@
/* 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 {
WCHAR *command; /* Command string to execute */
WCHAR *redirects; /* Redirects in place */
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 */
WCHAR pipeFile[MAX_PATH]; /* Where to get input from for pipes */
} CMD_LIST;
void WCMD_assoc (WCHAR *, BOOL);
......@@ -64,7 +72,6 @@ void WCMD_output (const WCHAR *format, ...);
void WCMD_output_asis (const WCHAR *message);
void WCMD_parse (WCHAR *s, WCHAR *q, WCHAR *p1, WCHAR *p2);
void WCMD_pause (void);
void WCMD_pipe (CMD_LIST **command, WCHAR *var, WCHAR *val);
void WCMD_popd (void);
void WCMD_print_error (void);
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