revise switchToLongcmd a bit. allow execution of mount/imgmount from menus and such.(beta3)
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3326
This commit is contained in:
parent
981fd5e269
commit
d8266a6a41
3 changed files with 19 additions and 19 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: shell.h,v 1.25 2009-01-19 19:55:03 qbix79 Exp $ */
|
||||
/* $Id: shell.h,v 1.26 2009-03-23 10:55:35 qbix79 Exp $ */
|
||||
|
||||
#ifndef DOSBOX_SHELL_H
|
||||
#define DOSBOX_SHELL_H
|
||||
|
@ -40,9 +40,6 @@ extern Bitu call_shellstop;
|
|||
* by "external" programs. (config) */
|
||||
extern Program * first_shell;
|
||||
|
||||
/* command_slashc indicates that the next commands are being run from command /c. Remove parameters for internal .COM files */
|
||||
extern bool command_slashc;
|
||||
|
||||
class DOS_Shell;
|
||||
|
||||
class BatchFile {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: programs.cpp,v 1.35 2009-02-01 14:19:20 qbix79 Exp $ */
|
||||
/* $Id: programs.cpp,v 1.36 2009-03-23 10:55:36 qbix79 Exp $ */
|
||||
|
||||
#include <vector>
|
||||
#include <ctype.h>
|
||||
|
@ -109,12 +109,22 @@ Program::Program() {
|
|||
extern std::string full_arguments;
|
||||
|
||||
void Program::ChangeToLongCmd() {
|
||||
CommandLine* temp = 0;
|
||||
//If command_slashc => then don't pass any parameters to the internal .COM files
|
||||
if(command_slashc) temp = new CommandLine(cmd->GetFileName(),"");
|
||||
else temp = new CommandLine(cmd->GetFileName(),full_arguments.c_str());
|
||||
delete cmd;
|
||||
cmd = temp;
|
||||
/*
|
||||
* Get arguments directly from the shell instead of the psp.
|
||||
* this is done in securemode: (as then the arguments to mount and friends
|
||||
* can only be given on the shell ( so no int 21 4b)
|
||||
* Securemode part is disabled as each of the internal command has already
|
||||
* protection for it. (and it breaks games like cdman)
|
||||
* it is also done for long arguments to as it is convient (as the total commandline can be longer then 127 characters.
|
||||
* imgmount with lot's of parameters
|
||||
* Length of arguments can be ~120. but switch when above 100 to be sure
|
||||
*/
|
||||
|
||||
if(/*control->SecureMode() ||*/ cmd->Get_arglength() > 100) {
|
||||
CommandLine* temp = new CommandLine(cmd->GetFileName(),full_arguments.c_str());
|
||||
delete cmd;
|
||||
cmd = temp;
|
||||
}
|
||||
full_arguments.assign(""); //Clear so it gets even more save
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: shell.cpp,v 1.97 2009-02-01 14:07:05 qbix79 Exp $ */
|
||||
/* $Id: shell.cpp,v 1.98 2009-03-23 10:55:36 qbix79 Exp $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -278,22 +278,15 @@ void DOS_Shell::RunInternal(void)
|
|||
return;
|
||||
}
|
||||
|
||||
bool command_slashc = false;
|
||||
|
||||
void DOS_Shell::Run(void) {
|
||||
char input_line[CMD_MAXLINE] = {0};
|
||||
std::string line;
|
||||
if (cmd->FindStringRemain("/C",line)) {
|
||||
//command_slashc indicates that the following commands are run with command /c. Forbid parameters to mount.
|
||||
//command_allready_set prevents against command /c "command /c command"
|
||||
bool command_allready_set = command_slashc;
|
||||
command_slashc = true;
|
||||
strcpy(input_line,line.c_str());
|
||||
DOS_Shell temp;
|
||||
temp.echo = echo;
|
||||
temp.ParseLine(input_line); //for *.exe *.com |*.bat creates the bf needed by runinternal;
|
||||
temp.RunInternal(); // exits when no bf is found.
|
||||
if(!command_allready_set) command_slashc = false;
|
||||
return;
|
||||
}
|
||||
/* Start a normal shell and check for a first command init */
|
||||
|
|
Loading…
Add table
Reference in a new issue