mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-08 19:32:39 +08:00
Add SET /ERASE as a way to clear the environment block
This commit is contained in:
parent
bf5400cf07
commit
b3e0e4c6f9
@ -1,4 +1,7 @@
|
||||
NEXT
|
||||
- SET command processing has been cleaned up and streamlined.
|
||||
Added /ERASE command line switch to clear the environment
|
||||
block (DOSBox-X extension). (joncampbell123).
|
||||
- VESA BIOS: Add new option to adjust reported linear framebuffer
|
||||
address by a specific number of pixels. This is needed by
|
||||
"Out of Control" by Contract which for whatever reason,
|
||||
|
@ -102,6 +102,7 @@ public:
|
||||
bool GetEnvNum(Bitu want_num,std::string & result); //! Return an environment variable by index
|
||||
Bitu GetEnvCount(void); //! Return the number of environmental variables
|
||||
bool SetEnv(const char * entry,const char * new_string); //! Set environment variable
|
||||
bool EraseEnv(void);
|
||||
virtual void WriteOut(const char *format, const char * arguments);
|
||||
void WriteOut(const char * format,...); //! Write to standard output
|
||||
virtual int WriteOut_NoParsing(const char * format, bool dbcs = false); //! Write to standard output, no parsing
|
||||
|
@ -497,6 +497,26 @@ void Program::DebugDumpEnv() {
|
||||
}
|
||||
}
|
||||
|
||||
bool Program::EraseEnv(void) {
|
||||
PhysPt env_base,env_fence;
|
||||
size_t nsl = 0,el = 0,needs;
|
||||
|
||||
if (dos_kernel_disabled) {
|
||||
LOG_MSG("BUG: Program::EraseEnv() called with DOS kernel disabled (such as OS boot).\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!LocateEnvironmentBlock(env_base,env_fence,psp->GetEnvironment())) {
|
||||
LOG_MSG("Warning: SetEnv() was not able to locate the program's environment block\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (PhysPt w=env_base;w < env_fence;w++)
|
||||
mem_writeb(w,0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* NTS: "entry" string must have already been converted to uppercase */
|
||||
bool Program::SetEnv(const char * entry,const char * new_string) {
|
||||
PhysPt env_base,env_fence,env_scan;
|
||||
|
@ -2732,7 +2732,8 @@ void DOS_Shell::CMD_SET(char * args) {
|
||||
enum op_mode_t {
|
||||
show_all_env,
|
||||
set_env,
|
||||
show_env
|
||||
show_env,
|
||||
erase_env
|
||||
};
|
||||
|
||||
op_mode_t op_mode = show_all_env;
|
||||
@ -2753,6 +2754,9 @@ void DOS_Shell::CMD_SET(char * args) {
|
||||
WriteOut("Set /P is not supported. Use Choice!"); /* TODO: What is SET /P supposed to do? */
|
||||
return;
|
||||
}
|
||||
else if (sw == "ERASE") { /* DOSBox-X extension: Completely erase the environment block */
|
||||
op_mode = erase_env;
|
||||
}
|
||||
else {
|
||||
WriteOut("Unknown switch /");
|
||||
WriteOut(sw.c_str());
|
||||
@ -2806,6 +2810,10 @@ void DOS_Shell::CMD_SET(char * args) {
|
||||
WriteOut(MSG_Get("SHELL_CMD_SET_OUT_OF_SPACE"));
|
||||
|
||||
break;
|
||||
case erase_env:
|
||||
if (!EraseEnv())
|
||||
WriteOut("Unable to erase environment block\n");
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user