diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index 1d73485b..6182fa18 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell.cpp,v 1.33 2003-09-08 18:25:44 qbix79 Exp $ */ +/* $Id: shell.cpp,v 1.34 2003-09-21 12:16:02 qbix79 Exp $ */ #include #include @@ -212,12 +212,19 @@ void AUTOEXEC_Init(Section * sec) { Section_line * section=static_cast(sec); char * extra=(char *)section->data.c_str(); if (extra) SHELL_AddAutoexec("%s",extra); + /* Check to see for extra command line options to be added (before the command specified on commandline) */ + while (control->cmdline->FindString("-c",line,true)) + SHELL_AddAutoexec((char *)line.c_str()); + + /* Check for the -exit switch which causes dosbox to when the command on the commandline has finished */ + bool addexit = control->cmdline->FindExist("-exit",true); + /* Check for first command being a directory or file */ char buffer[CROSS_LEN]; if (control->cmdline->FindCommand(1,line)) { struct stat test; strcpy(buffer,line.c_str()); - if (stat(buffer,&test)) { + if (stat(buffer,&test)){ getcwd(buffer,CROSS_LEN); strcat(buffer,line.c_str()); if (stat(buffer,&test)) goto nomount; @@ -233,12 +240,9 @@ void AUTOEXEC_Init(Section * sec) { SHELL_AddAutoexec("MOUNT C \"%s\"",buffer); SHELL_AddAutoexec("C:"); SHELL_AddAutoexec(name); + if(addexit) SHELL_AddAutoexec("exit"); } } - /* Check to see for extra command line options to be added */ - while (control->cmdline->FindString("-c",line,true)) { - SHELL_AddAutoexec((char *)line.c_str()); - } nomount: VFILE_Register("AUTOEXEC.BAT",(Bit8u *)autoexec_data,strlen(autoexec_data)); }