mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 16:12:04 +00:00
[CMD] Add a MSCMD_BATCH_ECHO define for enabling Windows' CMD.EXE way of preserving/restoring the echo flag across batch calls.
Observation shows that this is done only when the top-level batch file is being run (and then terminates); the echo flag is not restored to its previous state when a child batch file terminates and gives main back to its parent batch.
This commit is contained in:
parent
141378cfc8
commit
87a5403318
2 changed files with 30 additions and 0 deletions
|
@ -66,6 +66,10 @@
|
|||
BATCH_TYPE BatType = NONE;
|
||||
PBATCH_CONTEXT bc = NULL;
|
||||
|
||||
#ifdef MSCMD_BATCH_ECHO
|
||||
BOOL bBcEcho = TRUE;
|
||||
#endif
|
||||
|
||||
BOOL bEcho = TRUE; /* The echo flag */
|
||||
|
||||
/* Buffer for reading Batch file lines */
|
||||
|
@ -195,8 +199,10 @@ VOID ExitBatch(VOID)
|
|||
UndoRedirection(bc->RedirList, NULL);
|
||||
FreeRedirection(bc->RedirList);
|
||||
|
||||
#ifndef MSCMD_BATCH_ECHO
|
||||
/* Preserve echo state across batch calls */
|
||||
bEcho = bc->bEcho;
|
||||
#endif
|
||||
|
||||
while (bc->setlocal)
|
||||
cmd_endlocal(_T(""));
|
||||
|
@ -213,6 +219,10 @@ VOID ExitBatch(VOID)
|
|||
{
|
||||
CheckCtrlBreak(BREAK_OUTOFBATCH);
|
||||
BatType = NONE;
|
||||
|
||||
#ifdef MSCMD_BATCH_ECHO
|
||||
bEcho = bBcEcho;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -352,7 +362,9 @@ INT Batch(LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd)
|
|||
}
|
||||
|
||||
bc->mempos = 0; /* Go to the beginning of the batch file */
|
||||
#ifndef MSCMD_BATCH_ECHO
|
||||
bc->bEcho = bEcho; /* Preserve echo across batch calls */
|
||||
#endif
|
||||
for (i = 0; i < 10; i++)
|
||||
bc->shiftlevel[i] = i;
|
||||
|
||||
|
@ -381,6 +393,10 @@ INT Batch(LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd)
|
|||
{
|
||||
BatType = CMD_TYPE;
|
||||
}
|
||||
|
||||
#ifdef MSCMD_BATCH_ECHO
|
||||
bBcEcho = bEcho;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Check if this is a "CALL :label" */
|
||||
|
@ -424,6 +440,10 @@ INT Batch(LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd)
|
|||
{
|
||||
/* Reset the top-level batch context type */
|
||||
BatType = NONE;
|
||||
|
||||
#ifdef MSCMD_BATCH_ECHO
|
||||
bEcho = bBcEcho;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Restore the FOR variables */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue