From b6e8e135996cbd0b4ed3f5d6292e9a8f70c69ce2 Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Sat, 2 Jan 2010 17:04:05 -0800 Subject: [PATCH] cmd: Fix echoing of multiline commands. --- programs/cmd/wcmdmain.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index d5ef48c2749..e94cb3bb706 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -1269,13 +1269,6 @@ void WCMD_execute (WCHAR *command, WCHAR *redirects, handleExpansion(new_redir, (context != NULL), forVariable, forValue); cmd = new_cmd; - /* Show prompt before batch line IF echo is on and in batch program */ - if (context && echo_mode && (cmd[0] != '@')) { - WCMD_show_prompt(); - WCMD_output_asis ( cmd); - WCMD_output_asis ( newline); - } - /* * Changing default drive has to be handled as a special case. */ @@ -1774,6 +1767,12 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF /* Replace env vars if in a batch context */ if (context) handleExpansion(extraSpace, FALSE, NULL, NULL); + /* Show prompt before batch line IF echo is on and in batch program */ + if (context && echo_mode && extraSpace[0] && (extraSpace[0] != '@')) { + WCMD_show_prompt(); + WCMD_output_asis(extraSpace); + WCMD_output_asis(newline); + } /* Start with an empty string, copying to the command string */ curStringLen = 0; @@ -2106,6 +2105,11 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF } curPos = extraSpace; if (context) handleExpansion(extraSpace, FALSE, NULL, NULL); + /* Continue to echo commands IF echo is on and in batch program */ + if (context && echo_mode && extraSpace[0] && (extraSpace[0] != '@')) { + WCMD_output_asis(extraSpace); + WCMD_output_asis(newline); + } } }