changed commandline handling for commands run in dosbox
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@268
This commit is contained in:
parent
0c603eab1e
commit
bced0324fe
2 changed files with 21 additions and 13 deletions
|
@ -42,9 +42,10 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
char drive; drive=toupper(*prog_info->cmd_line);
|
||||
char* line=trim(prog_info->cmd_line);
|
||||
char drive; drive=toupper(*line);
|
||||
|
||||
char * dir=strchr(prog_info->cmd_line,' '); if (dir) {
|
||||
char * dir=strchr(line,' '); if (dir) {
|
||||
if (!*dir) dir=0;
|
||||
else dir=trim(dir);
|
||||
}
|
||||
|
@ -179,20 +180,21 @@ void UPCASE::Run(void) {
|
|||
WriteOut("Otherwise you might horribly screw up your filesystem.\n");
|
||||
return;
|
||||
}
|
||||
if (stat(prog_info->cmd_line,&info)) {
|
||||
WriteOut("%s doesn't exist\n",prog_info->cmd_line);
|
||||
char* line=trim(prog_info->cmd_line);
|
||||
if (stat(line,&info)) {
|
||||
WriteOut("%s doesn't exist\n",line);
|
||||
return;
|
||||
}
|
||||
if(!S_ISDIR(info.st_mode)) {
|
||||
WriteOut("%s isn't a directory\n",prog_info->cmd_line);
|
||||
WriteOut("%s isn't a directory\n",line);
|
||||
return;
|
||||
}
|
||||
WriteOut("Converting the wrong directories can be very harmfull, please be carefull.\n");
|
||||
WriteOut("Are you really really sure you want to convert %s to upcase?Y/N\n",prog_info->cmd_line);
|
||||
WriteOut("Are you really really sure you want to convert %s to upcase?Y/N\n",line);
|
||||
Bit8u key;Bit16u n=1;
|
||||
DOS_ReadFile(STDIN,&key,&n);
|
||||
if (toupper(key)=='Y') {
|
||||
upcasedir(prog_info->cmd_line);
|
||||
upcasedir(line);
|
||||
} else {
|
||||
WriteOut("Okay better not do it.\n");
|
||||
}
|
||||
|
|
|
@ -126,7 +126,13 @@ void DOS_Shell::InputCommand(char * line) {
|
|||
|
||||
void DOS_Shell::Execute(char * name,char * args) {
|
||||
char * fullname;
|
||||
|
||||
char line[255];
|
||||
if(strlen(args)!=0){
|
||||
line[0]=' ';line[1]=0;
|
||||
strcat(line,args);
|
||||
}else{
|
||||
line[0]=0;
|
||||
};
|
||||
/* check for a drive change */
|
||||
if ((strcmp(name + 1, ":") == 0) && isalpha(*name))
|
||||
{
|
||||
|
@ -143,7 +149,7 @@ void DOS_Shell::Execute(char * name,char * args) {
|
|||
}
|
||||
if (strcasecmp(strrchr(fullname, '.'), ".bat") == 0) {
|
||||
/* Run the .bat file */
|
||||
bf=new BatchFile(this,fullname,args);
|
||||
bf=new BatchFile(this,fullname,line);
|
||||
} else {
|
||||
/* Run the .exe or .com file from the shell */
|
||||
/* Allocate some stack space for tables in physical memory */
|
||||
|
@ -155,10 +161,10 @@ void DOS_Shell::Execute(char * name,char * args) {
|
|||
MEM_BlockWrite(Real2Phys(file_name),fullname,strlen(fullname)+1);
|
||||
/* Fill the command line */
|
||||
CommandTail cmd;
|
||||
if (strlen(args)>126) args[126]=0;
|
||||
cmd.count=strlen(args);
|
||||
memcpy(cmd.buffer,args,strlen(args));
|
||||
cmd.buffer[strlen(args)]=0xd;
|
||||
if (strlen(line)>126) line[126]=0;
|
||||
cmd.count=strlen(line);
|
||||
memcpy(cmd.buffer,line,strlen(line));
|
||||
cmd.buffer[strlen(line)]=0xd;
|
||||
MEM_BlockWrite(PhysMake(prog_info->psp_seg,128),&cmd,128);
|
||||
|
||||
block.InitExec(RealMake(prog_info->psp_seg,128));
|
||||
|
|
Loading…
Add table
Reference in a new issue