1
0
Fork 0

Add patch 3027944 from ripsaw: Subst /d

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3628
This commit is contained in:
Peter Veenstra 2010-08-07 18:12:48 +00:00
parent 58e87f9717
commit 901e771bfa
2 changed files with 9 additions and 4 deletions

View file

@ -487,7 +487,7 @@ void SHELL_Init() {
MSG_Add("SHELL_CMD_PAUSE_HELP","Waits for 1 keystroke to continue.\n");
MSG_Add("SHELL_CMD_COPY_FAILURE","Copy failure : %s.\n");
MSG_Add("SHELL_CMD_COPY_SUCCESS"," %d File(s) copied.\n");
MSG_Add("SHELL_CMD_SUBST_NO_REMOVE","Removing drive not supported. Doing nothing.\n");
MSG_Add("SHELL_CMD_SUBST_NO_REMOVE","Unable to remove, drive not in use.\n");
MSG_Add("SHELL_CMD_SUBST_FAILURE","SUBST failed. You either made an error in your commandline or the target drive is already used.\nIt's only possible to use SUBST on Local drives");
MSG_Add("SHELL_STARTUP_BEGIN",

View file

@ -945,17 +945,22 @@ void DOS_Shell::CMD_SUBST (char * args) {
CommandLine command(0,args);
if (command.GetCount() != 2) throw 0 ;
command.FindCommand(2,arg);
if((arg=="/D" ) || (arg=="/d")) throw 1; //No removal (one day)
command.FindCommand(1,arg);
if( (arg.size()>1) && arg[1] !=':') throw(0);
temp_str[0]=(char)toupper(args[0]);
command.FindCommand(2,arg);
if((arg=="/D") || (arg=="/d")) {
if(!Drives[temp_str[0]-'A'] ) throw 1; //targetdrive not in use
strcat(mountstring,"-u ");
strcat(mountstring,temp_str);
this->ParseLine(mountstring);
return;
}
if(Drives[temp_str[0]-'A'] ) throw 0; //targetdrive in use
strcat(mountstring,temp_str);
strcat(mountstring," ");
command.FindCommand(2,arg);
Bit8u drive;char fulldir[DOS_PATHLENGTH];
if (!DOS_MakeName(const_cast<char*>(arg.c_str()),fulldir,&drive)) throw 0;