1
0
Fork 0

Spaces in LOG_MSG and some at the end of the line.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3999
This commit is contained in:
Peter Veenstra 2016-10-02 14:12:32 +00:00
parent b9b9e2c7d1
commit a3345eed24
6 changed files with 103 additions and 103 deletions

View file

@ -31,7 +31,7 @@
Bitu call_shellstop;
/* Larger scope so shell_del autoexec can use it to
* remove things from the environment */
Program * first_shell = 0;
Program * first_shell = 0;
static Bitu shellstop_handler(void) {
return CBRET_STOP;
@ -163,9 +163,9 @@ Bitu DOS_Shell::GetRedirection(char *s, char **ifn, char **ofn,bool * append) {
while (*lr && *lr!=' ' && *lr!='<' && *lr!='|') lr++;
//if it ends on a : => remove it.
if((*ofn != lr) && (lr[-1] == ':')) lr[-1] = 0;
// if(*lr && *(lr+1))
// *lr++=0;
// else
// if(*lr && *(lr+1))
// *lr++=0;
// else
// *lr=0;
t = (char*)malloc(lr-*ofn+1);
safe_strncpy(t,*ofn,lr-*ofn+1);
@ -177,9 +177,9 @@ Bitu DOS_Shell::GetRedirection(char *s, char **ifn, char **ofn,bool * append) {
*ifn=lr;
while (*lr && *lr!=' ' && *lr!='>' && *lr != '|') lr++;
if((*ifn != lr) && (lr[-1] == ':')) lr[-1] = 0;
// if(*lr && *(lr+1))
// *lr++=0;
// else
// if(*lr && *(lr+1))
// *lr++=0;
// else
// *lr=0;
t = (char*)malloc(lr-*ifn+1);
safe_strncpy(t,*ifn,lr-*ifn+1);
@ -193,7 +193,7 @@ Bitu DOS_Shell::GetRedirection(char *s, char **ifn, char **ofn,bool * append) {
}
*lw=0;
return num;
}
}
void DOS_Shell::ParseLine(char * line) {
LOG(LOG_EXEC,LOG_ERROR)("Parsing command line: %s",line);
@ -202,7 +202,7 @@ void DOS_Shell::ParseLine(char * line) {
line = trim(line);
/* Do redirection and pipe checks */
char * in = 0;
char * out = 0;
@ -212,23 +212,23 @@ void DOS_Shell::ParseLine(char * line) {
bool append;
bool normalstdin = false; /* wether stdin/out are open on start. */
bool normalstdout = false; /* Bug: Assumed is they are "con" */
num = GetRedirection(line,&in, &out,&append);
if (num>1) LOG_MSG("SHELL:Multiple command on 1 line not supported");
if (num>1) LOG_MSG("SHELL: Multiple command on 1 line not supported");
if (in || out) {
normalstdin = (psp->GetFileHandle(0) != 0xff);
normalstdout = (psp->GetFileHandle(1) != 0xff);
normalstdin = (psp->GetFileHandle(0) != 0xff);
normalstdout = (psp->GetFileHandle(1) != 0xff);
}
if (in) {
if(DOS_OpenFile(in,OPEN_READ,&dummy)) { //Test if file exists
DOS_CloseFile(dummy);
LOG_MSG("SHELL:Redirect input from %s",in);
LOG_MSG("SHELL: Redirect input from %s",in);
if(normalstdin) DOS_CloseFile(0); //Close stdin
DOS_OpenFile(in,OPEN_READ,&dummy); //Open new stdin
}
}
if (out){
LOG_MSG("SHELL:Redirect output to %s",out);
LOG_MSG("SHELL: Redirect output to %s",out);
if(normalstdout) DOS_CloseFile(1);
if(!normalstdin && !in) DOS_OpenFile("con",OPEN_READWRITE,&dummy);
bool status = true;
@ -242,7 +242,7 @@ void DOS_Shell::ParseLine(char * line) {
} else {
status = DOS_OpenFileExtended(out,OPEN_READWRITE,DOS_ATTR_ARCHIVE,0x12,&dummy,&dummy2);
}
if(!status && normalstdout) DOS_OpenFile("con",OPEN_READWRITE,&dummy); //Read only file, open con again
if(!normalstdin && !in) DOS_CloseFile(0);
}
@ -309,7 +309,7 @@ void DOS_Shell::Run(void) {
line.erase();
ParseLine(input_line);
} else {
WriteOut(MSG_Get("SHELL_STARTUP_SUB"),VERSION);
WriteOut(MSG_Get("SHELL_STARTUP_SUB"),VERSION);
}
do {
if (bf){
@ -387,7 +387,7 @@ public:
bool command_found = false;
while (control->cmdline->FindCommand(dummy++,line) && !command_found) {
struct stat test;
if (line.length() > CROSS_LEN) continue;
if (line.length() > CROSS_LEN) continue;
strcpy(buffer,line.c_str());
if (stat(buffer,&test)) {
if (getcwd(buffer,CROSS_LEN) == NULL) continue;
@ -396,14 +396,14 @@ public:
strcat(buffer,line.c_str());
if (stat(buffer,&test)) continue;
}
if (test.st_mode & S_IFDIR) {
if (test.st_mode & S_IFDIR) {
autoexec[12].Install(std::string("MOUNT C \"") + buffer + "\"");
autoexec[13].Install("C:");
if(secure) autoexec[14].Install("z:\\config.com -securemode");
command_found = true;
} else {
char* name = strrchr(buffer,CROSS_FILESPLIT);
if (!name) { //Only a filename
if (!name) { //Only a filename
line = buffer;
if (getcwd(buffer,CROSS_LEN) == NULL) continue;
if (strlen(buffer) + line.length() + 1 > CROSS_LEN) continue;
@ -446,7 +446,7 @@ public:
}
/* Combining -securemode, noautoexec and no parameters leaves you with a lovely Z:\. */
if ( !command_found ) {
if ( !command_found ) {
if ( secure ) autoexec[12].Install("z:\\config.com -securemode");
}
VFILE_Register("AUTOEXEC.BAT",(Bit8u *)autoexec_data,(Bit32u)strlen(autoexec_data));
@ -677,7 +677,7 @@ void SHELL_Init() {
envmcb.SetPSPSeg(psp_seg); // MCB of the command shell environment
envmcb.SetSize(DOS_MEM_START-env_seg);
envmcb.SetType(0x4d);
/* Setup environment */
PhysPt env_write=PhysMake(env_seg,0);
MEM_BlockWrite(env_write,path_string,(Bitu)(strlen(path_string)+1));
@ -692,7 +692,7 @@ void SHELL_Init() {
DOS_PSP psp(psp_seg);
psp.MakeNew(0);
dos.psp(psp_seg);
/* The start of the filetable in the psp must look like this:
* 01 01 01 00 02
* In order to achieve this: First open 2 files. Close the first and
@ -715,12 +715,12 @@ void SHELL_Init() {
memset(&tail.buffer,0,127);
strcpy(tail.buffer,init_line);
MEM_BlockWrite(PhysMake(psp_seg,128),&tail,128);
/* Setup internal DOS Variables */
dos.dta(RealMake(psp_seg,0x80));
dos.psp(psp_seg);
SHELL_ProgramStart(&first_shell);
first_shell->Run();
delete first_shell;