diff options
author | Wengier <wengierwu@yahoo.com> | 2022-09-11 06:43:54 +0300 |
---|---|---|
committer | Wengier <wengierwu@yahoo.com> | 2022-09-12 02:02:24 +0300 |
commit | a656e6cd15eecd6cfe92f9a6d0502d8083a67ac9 (patch) | |
tree | 20d20100c1fa461bd2fdc8fb8227cd4f77e39345 | |
parent | 76d1faf46a4f3eb2bc9c409c48261f081975c4e1 (diff) |
Disable variable expansion in the shell by default with option to enable itww/expand_shell_variable
-rw-r--r-- | src/dosbox.cpp | 5 | ||||
-rw-r--r-- | src/shell/shell_misc.cpp | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/dosbox.cpp b/src/dosbox.cpp index ff73cad75..52fec56c5 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -1140,6 +1140,11 @@ void DOSBOX_Init() { "If set to 0, the country code corresponding to the\n" "selected keyboard layout will be used."); + Pbool = secprop->Add_bool("expand_shell_variable", when_idle, false); + Pbool->Set_help("Enable expanding environment variables such as %PATH%\n" + "while in the DOS command shell. FreeDOS and MS-DOS 7/8\n" + "COMMAND.COM supports this behavior."); + secprop->AddInitFunction(&DOS_KeyboardLayout_Init,true); Pstring = secprop->Add_string("keyboardlayout", when_idle, "auto"); Pstring->Set_help("Language code of the keyboard layout (or none)."); diff --git a/src/shell/shell_misc.cpp b/src/shell/shell_misc.cpp index 9e248a3e7..38a4aa45e 100644 --- a/src/shell/shell_misc.cpp +++ b/src/shell/shell_misc.cpp @@ -420,7 +420,10 @@ void DOS_Shell::InputCommand(char * line) { if (l_completion.size()) l_completion.clear(); /* DOS %variable% substitution */ - ProcessCmdLineEnvVarStitution(line); + const auto dos = static_cast<Section_prop *>(control->GetSection("dos")); + assert(dos); + if (dos->Get_bool("expand_shell_variable")) + ProcessCmdLineEnvVarStitution(line); } /* Note: Buffer pointed to by "line" must be at least CMD_MAXLINE+1 bytes long! */ |