diff --git a/src/gui/midi.cpp b/src/gui/midi.cpp index e7cc6d42..57181e00 100644 --- a/src/gui/midi.cpp +++ b/src/gui/midi.cpp @@ -104,10 +104,10 @@ void MIDI_RawOutByte(Bit8u data) { midi.rt_buf[0]=data; midi.handler->PlayMsg(midi.rt_buf); return; - } + } /* Test for a active sysex tranfer */ if (midi.status==0xf0) { - if (!(data&0x80)) { + if (!(data&0x80)) { if (midi.sysex.used<(SYSEX_SIZE-1)) midi.sysex.buf[midi.sysex.used++] = data; return; } else { @@ -175,7 +175,7 @@ public: if (fullconf.find("delaysysex") != std::string::npos) { midi.sysex.start = GetTicks(); fullconf.erase(fullconf.find("delaysysex")); - LOG_MSG("MIDI:Using delayed SysEx processing"); + LOG_MSG("MIDI: Using delayed SysEx processing"); } std::remove(fullconf.begin(), fullconf.end(), ' '); const char * conf = fullconf.c_str(); @@ -187,24 +187,24 @@ public: while (handler) { if (!strcasecmp(dev,handler->GetName())) { if (!handler->Open(conf)) { - LOG_MSG("MIDI:Can't open device:%s with config:%s.",dev,conf); + LOG_MSG("MIDI: Can't open device:%s with config:%s.",dev,conf); goto getdefault; } midi.handler=handler; - midi.available=true; - LOG_MSG("MIDI:Opened device:%s",handler->GetName()); + midi.available=true; + LOG_MSG("MIDI: Opened device:%s",handler->GetName()); return; } handler=handler->next; } - LOG_MSG("MIDI:Can't find device:%s, finding default handler.",dev); -getdefault: + LOG_MSG("MIDI: Can't find device:%s, finding default handler.",dev); +getdefault: handler=handler_list; while (handler) { if (handler->Open(conf)) { - midi.available=true; + midi.available=true; midi.handler=handler; - LOG_MSG("MIDI:Opened device:%s",handler->GetName()); + LOG_MSG("MIDI: Opened device:%s",handler->GetName()); return; } handler=handler->next; diff --git a/src/gui/midi_win32.h b/src/gui/midi_win32.h index a34451cb..670027ee 100644 --- a/src/gui/midi_win32.h +++ b/src/gui/midi_win32.h @@ -46,7 +46,7 @@ public: if(nummer < midiOutGetNumDevs()){ MIDIOUTCAPS mididev; midiOutGetDevCaps(nummer, &mididev, sizeof(MIDIOUTCAPS)); - LOG_MSG("MIDI:win32 selected %s",mididev.szPname); + LOG_MSG("MIDI: win32 selected %s",mididev.szPname); res = midiOutOpen(&m_out, nummer, (DWORD_PTR)m_event, 0, CALLBACK_EVENT); } } else { @@ -70,9 +70,9 @@ public: if (WaitForSingleObject (m_event, 2000) == WAIT_TIMEOUT) { LOG(LOG_MISC,LOG_ERROR)("Can't send midi message"); return; - } + } midiOutUnprepareHeader (m_out, &m_hdr, sizeof (m_hdr)); - + m_hdr.lpData = (char *) sysex; m_hdr.dwBufferLength = len ; m_hdr.dwBytesRecorded = len ; @@ -88,7 +88,7 @@ public: } } void ListAll(Program* base) { - unsigned int total = midiOutGetNumDevs(); + unsigned int total = midiOutGetNumDevs(); for(unsigned int i = 0;i < total;i++) { MIDIOUTCAPS mididev; midiOutGetDevCaps(i, &mididev, sizeof(MIDIOUTCAPS)); @@ -97,6 +97,6 @@ public: } }; -MidiHandler_win32 Midi_win32; +MidiHandler_win32 Midi_win32; diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index fa4e96d4..ad1d427b 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -235,7 +235,7 @@ SDL_Surface* SDL_SetVideoMode_Wrap(int width,int height,int bpp,Bit32u flags){ #if SETMODE_SAVES_CLEAR //TODO clear it. #ifdef C_OPENGL - if ((flags & SDL_OPENGL)==0) + if ((flags & SDL_OPENGL)==0) SDL_FillRect(sdl.surface,NULL,SDL_MapRGB(sdl.surface->format,0,0,0)); else { glClearColor (0.0, 0.0, 0.0, 1.0); @@ -355,7 +355,7 @@ static void PauseDOSBox(bool pressed) { /* On macs, all aps exit when pressing cmd-q */ KillSwitch(true); break; - } + } #endif } } @@ -478,13 +478,13 @@ static SDL_Surface * GFX_SetupSurfaceScaled(Bit32u sdl_flags, Bit32u bpp) { if ( ratio_w < ratio_h) { sdl.clip.w=fixedWidth; sdl.clip.h=(Bit16u)(sdl.draw.height*sdl.draw.scaley*ratio_w + 0.1); //possible rounding issues - } else { - /* + } else { + /* * The 0.4 is there to correct for rounding issues. - * (partly caused by the rounding issues fix in RENDER_SetSize) - */ + * (partly caused by the rounding issues fix in RENDER_SetSize) + */ sdl.clip.w=(Bit16u)(sdl.draw.width*sdl.draw.scalex*ratio_h + 0.4); - sdl.clip.h=(Bit16u)fixedHeight; + sdl.clip.h=(Bit16u)fixedHeight; } if (sdl.desktop.fullscreen) sdl.surface = SDL_SetVideoMode_Wrap(fixedWidth,fixedHeight,bpp,sdl_flags); @@ -660,7 +660,7 @@ dosurface: if (!GFX_SetupSurfaceScaled(0,0)) goto dosurface; sdl.overlay=SDL_CreateYUVOverlay(width*2,height,SDL_UYVY_OVERLAY,sdl.surface); if (!sdl.overlay) { - LOG_MSG("SDL:Failed to create overlay, switching back to surface"); + LOG_MSG("SDL: Failed to create overlay, switching back to surface"); goto dosurface; } sdl.desktop.type=SCREEN_OVERLAY; @@ -679,7 +679,7 @@ dosurface: if (!(flags&GFX_CAN_32) || (flags & GFX_RGBONLY)) goto dosurface; int texsize=2 << int_log2(width > height ? width : height); if (texsize>sdl.opengl.max_texsize) { - LOG_MSG("SDL:OPENGL:No support for texturesize of %d, falling back to surface",texsize); + LOG_MSG("SDL:OPENGL: No support for texturesize of %d, falling back to surface",texsize); goto dosurface; } SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); @@ -688,7 +688,7 @@ dosurface: #endif GFX_SetupSurfaceScaled(SDL_OPENGL,0); if (!sdl.surface || sdl.surface->format->BitsPerPixel<15) { - LOG_MSG("SDL:OPENGL:Can't open drawing surface, are you running in 16bpp(or higher) mode?"); + LOG_MSG("SDL:OPENGL: Can't open drawing surface, are you running in 16bpp (or higher) mode?"); goto dosurface; } /* Create the texture and display list */ @@ -804,7 +804,7 @@ void sticky_keys(bool restore){ if (!inited){ inited = true; SystemParametersInfo(SPI_GETSTICKYKEYS, sizeof(STICKYKEYS), &stick_keys, 0); - } + } if (restore) { SystemParametersInfo(SPI_SETSTICKYKEYS, sizeof(STICKYKEYS), &stick_keys, 0); return; @@ -828,7 +828,7 @@ void GFX_SwitchFullScreen(void) { #endif } else { if (sdl.mouse.locked) GFX_CaptureMouse(); -#if defined (WIN32) +#if defined (WIN32) sticky_keys(true); //restore sticky keys to default state in windowed mode. #endif } @@ -979,7 +979,7 @@ void GFX_EndUpdate( const Bit16u *changedLines ) { IDirectDrawSurface3_Restore(sdl.surface->hwdata->dd_surface); break; default: - LOG_MSG("DDRAW:Failed to blit, error %X",ret); + LOG_MSG("DDRAW: Failed to blit, error %X",ret); } SDL_Flip(sdl.surface); break; @@ -1288,7 +1288,7 @@ static void GUI_StartUp(Section * sec) { sdl.opengl.bilinear=false; #endif } else { - LOG_MSG("SDL:Unsupported output device %s, switching back to surface",output.c_str()); + LOG_MSG("SDL: Unsupported output device %s, switching back to surface",output.c_str()); sdl.desktop.want_type=SCREEN_SURFACE;//SHOULDN'T BE POSSIBLE anymore } @@ -1330,7 +1330,7 @@ static void GUI_StartUp(Section * sec) { if (sdl.surface == NULL) E_Exit("Could not initialize video: %s",SDL_GetError()); sdl.desktop.bpp=sdl.surface->format->BitsPerPixel; if (sdl.desktop.bpp==24) { - LOG_MSG("SDL:You are running in 24 bpp mode, this will slow down things!"); + LOG_MSG("SDL: You are running in 24 bpp mode, this will slow down things!"); } GFX_Stop(); SDL_WM_SetCaption("DOSBox",VERSION); @@ -1606,14 +1606,14 @@ void GFX_Events() { // ignore tab events that arrive just after regaining focus. (likely the result of alt-tab) if ((event.key.keysym.sym == SDLK_TAB) && (GetTicks() - sdl.focus_ticks < 2)) break; #endif -#if defined (MACOSX) +#if defined (MACOSX) case SDL_KEYDOWN: case SDL_KEYUP: /* On macs CMD-Q is the default key to close an application */ if (event.key.keysym.sym == SDLK_q && (event.key.keysym.mod == KMOD_RMETA || event.key.keysym.mod == KMOD_LMETA) ) { KillSwitch(true); break; - } + } #endif default: void MAPPER_CheckEvent(SDL_Event * event); @@ -1663,7 +1663,7 @@ void Config_Add_SDL() { Pbool = sdl_sec->Add_bool("fullscreen",Property::Changeable::Always,false); Pbool->Set_help("Start dosbox directly in fullscreen. (Press ALT-Enter to go back)"); - + Pbool = sdl_sec->Add_bool("fulldouble",Property::Changeable::Always,false); Pbool->Set_help("Use double buffering in fullscreen. It can reduce screen flickering, but it can also result in a slow DOSBox."); @@ -1736,7 +1736,7 @@ static void show_warning(char const * const message) { Bit32u bmask = 0x0000ff00; #else Bit32u rmask = 0x000000ff; - Bit32u gmask = 0x0000ff00; + Bit32u gmask = 0x0000ff00; Bit32u bmask = 0x00ff0000; #endif SDL_Surface* splash_surf = SDL_CreateRGBSurface(SDL_SWSURFACE, 640, 400, 32, rmask, gmask, bmask, 0); @@ -1745,22 +1745,22 @@ static void show_warning(char const * const message) { int x = 120,y = 20; std::string m(message),m2; std::string::size_type a,b,c,d; - + while(m.size()) { //Max 50 characters. break on space before or on a newline c = m.find('\n'); d = m.rfind(' ',50); if(c>d) a=b=d; else a=b=c; - if( a != std::string::npos) b++; + if( a != std::string::npos) b++; m2 = m.substr(0,a); m.erase(0,b); OutputString(x,y,m2.c_str(),0xffffffff,0,splash_surf); y += 20; } - + SDL_BlitSurface(splash_surf, NULL, sdl.surface, NULL); SDL_Flip(sdl.surface); SDL_Delay(12000); } - + static void launcheditor() { std::string path,file; Cross::CreatePlatformConfigDir(path); @@ -1852,7 +1852,7 @@ static void printconfiglocation() { Cross::CreatePlatformConfigDir(path); Cross::GetPlatformConfigName(file); path += file; - + FILE* f = fopen(path.c_str(),"r"); if(!f && !control->PrintConfig(path.c_str())) { printf("tried creating %s. but failed",path.c_str()); @@ -1916,7 +1916,7 @@ int main(int argc, char* argv[]) { if(control->cmdline->FindExist("-resetconf")) eraseconfigfile(); if(control->cmdline->FindExist("-erasemapper")) erasemapperfile(); if(control->cmdline->FindExist("-resetmapper")) erasemapperfile(); - + /* Can't disable the console with debugger enabled */ #if defined(WIN32) && !(C_DEBUG) if (control->cmdline->FindExist("-noconsole")) { @@ -2028,7 +2028,7 @@ int main(int argc, char* argv[]) { /* Parse configuration files */ std::string config_file,config_path; Cross::GetPlatformConfigDir(config_path); - + //First parse -userconf if(control->cmdline->FindExist("-userconf",true)){ config_file.clear(); @@ -2131,7 +2131,7 @@ int main(int argc, char* argv[]) { } #if defined (WIN32) sticky_keys(true); //Might not be needed if the shutdown function switches to windowed mode, but it doesn't hurt -#endif +#endif //Force visible mouse to end user. Somehow this sometimes doesn't happen SDL_WM_GrabInput(SDL_GRAB_OFF); SDL_ShowCursor(SDL_ENABLE); diff --git a/src/hardware/mixer.cpp b/src/hardware/mixer.cpp index 41ebcc2b..9a6ffcdd 100644 --- a/src/hardware/mixer.cpp +++ b/src/hardware/mixer.cpp @@ -17,7 +17,7 @@ */ -/* +/* Remove the sdl code from here and have it handeld in the sdlmain. That should call the mixer start from there or something. */ @@ -261,7 +261,7 @@ thestart: void MixerChannel::AddStretched(Bitu len,Bit16s * data) { if (done>=needed) { - LOG_MSG("Can't add, buffer full"); + LOG_MSG("Can't add, buffer full"); return; } Bitu outlen=needed-done;Bits diff; @@ -349,7 +349,7 @@ void MixerChannel::FillUp(void) { extern bool ticksLocked; static inline bool Mixer_irq_important(void) { - /* In some states correct timing of the irqs is more important then + /* In some states correct timing of the irqs is more important then * non stuttering audo */ return (ticksLocked || (CaptureState & (CAPTURE_WAVE|CAPTURE_VIDEO))); } @@ -364,7 +364,7 @@ static void MIXER_MixData(Bitu needed) { if (CaptureState & (CAPTURE_WAVE|CAPTURE_VIDEO)) { Bit16s convert[1024][2]; Bitu added=needed-mixer.done; - if (added>1024) + if (added>1024) added=1024; Bitu readpos=(mixer.pos+mixer.done)&MIXER_BUFMASK; for (Bitu i=0;i MIXER_BUFSIZE) index_add = MIXER_BUFSIZE - 2*mixer.min_needed; - else + else index_add = mixer.done - 2*mixer.min_needed; index_add = (index_add << MIXER_SHIFT) / need; reduce = mixer.done - 2* mixer.min_needed; @@ -476,7 +476,7 @@ static void SDLCALL MIXER_CallBack(void * userdata, Uint8 *stream, int len) { if (chan->done>reduce) chan->done-=reduce; else chan->done=0; } - + // Reset mixer.tick_add when irqs are important if( Mixer_irq_important() ) mixer.tick_add=(mixer.freq<< MIXER_SHIFT)/1000; @@ -566,7 +566,7 @@ public: chan=mixer.channels; WriteOut("Channel Main Main(dB)\n"); ShowVolume("MASTER",mixer.mastervol[0],mixer.mastervol[1]); - for (chan=mixer.channels;chan;chan=chan->next) + for (chan=mixer.channels;chan;chan=chan->next) ShowVolume(chan->name,chan->volmain[0],chan->volmain[1]); } private: @@ -635,17 +635,17 @@ void MIXER_Init(Section* sec) { mixer.tick_remain=0; if (mixer.nosound) { - LOG_MSG("MIXER:No Sound Mode Selected."); + LOG_MSG("MIXER: No Sound Mode Selected."); mixer.tick_add=((mixer.freq) << MIXER_SHIFT)/1000; TIMER_AddTickHandler(MIXER_Mix_NoSound); } else if (SDL_OpenAudio(&spec, &obtained) <0 ) { mixer.nosound = true; - LOG_MSG("MIXER:Can't open audio: %s , running in nosound mode.",SDL_GetError()); + LOG_MSG("MIXER: Can't open audio: %s , running in nosound mode.",SDL_GetError()); mixer.tick_add=((mixer.freq) << MIXER_SHIFT)/1000; TIMER_AddTickHandler(MIXER_Mix_NoSound); } else { if((mixer.freq != obtained.freq) || (mixer.blocksize != obtained.samples)) - LOG_MSG("MIXER:Got different values from SDL: freq %d, blocksize %d",obtained.freq,obtained.samples); + LOG_MSG("MIXER: Got different values from SDL: freq %d, blocksize %d",obtained.freq,obtained.samples); mixer.freq=obtained.freq; mixer.blocksize=obtained.samples; mixer.tick_add=(mixer.freq << MIXER_SHIFT)/1000; diff --git a/src/ints/ems.cpp b/src/ints/ems.cpp index 3d2e1d74..2b70e828 100644 --- a/src/ints/ems.cpp +++ b/src/ints/ems.cpp @@ -95,7 +95,7 @@ static EMM_Mapping emm_mappings[EMM_MAX_PHYS]; static EMM_Mapping emm_segmentmappings[0x40]; -static Bit16u GEMMIS_seg; +static Bit16u GEMMIS_seg; class device_EMM : public DOS_Device { public: @@ -105,8 +105,8 @@ public: GEMMIS_seg=0; } bool Read(Bit8u * /*data*/,Bit16u * /*size*/) { return false;} - bool Write(Bit8u * /*data*/,Bit16u * /*size*/){ - LOG(LOG_IOCTL,LOG_NORMAL)("EMS:Write to device"); + bool Write(Bit8u * /*data*/,Bit16u * /*size*/){ + LOG(LOG_IOCTL,LOG_NORMAL)("EMS:Write to device"); return false; } bool Seek(Bit32u * /*pos*/,Bit32u /*type*/){return false;} @@ -119,7 +119,7 @@ private: bool is_emm386; }; -bool device_EMM::ReadFromControlChannel(PhysPt bufptr,Bit16u size,Bit16u * retcode) { +bool device_EMM::ReadFromControlChannel(PhysPt bufptr,Bit16u size,Bit16u * retcode) { Bitu subfct=mem_readb(bufptr); switch (subfct) { case 0x00: @@ -301,19 +301,19 @@ static Bit8u EMM_MapPage(Bitu phys_page,Bit16u handle,Bit16u log_page) { /* Unmapping */ emm_mappings[phys_page].handle=NULL_HANDLE; emm_mappings[phys_page].page=NULL_PAGE; - for (Bitu i=0;i<4;i++) + for (Bitu i=0;i<4;i++) PAGING_MapPage(EMM_PAGEFRAME4K+phys_page*4+i,EMM_PAGEFRAME4K+phys_page*4+i); PAGING_ClearTLB(); return EMM_NO_ERROR; } /* Check for valid handle */ if (!ValidHandle(handle)) return EMM_INVALID_HANDLE; - + if (log_page>10].handle=NULL_HANDLE; emm_segmentmappings[segment>>10].page=NULL_PAGE; } - for (Bitu i=0;i<4;i++) + for (Bitu i=0;i<4;i++) PAGING_MapPage(segment*16/4096+i,segment*16/4096+i); PAGING_ClearTLB(); return EMM_NO_ERROR; } /* Check for valid handle */ if (!ValidHandle(handle)) return EMM_INVALID_HANDLE; - + if (log_page=0) && (tphysPage>10].handle=handle; emm_segmentmappings[segment>>10].page=log_page; } - + MemHandle memh=MEM_NextHandleAt(emm_handles[handle].mem,log_page*4);; for (Bitu i=0;i<4;i++) { PAGING_MapPage(segment*16/4096+i,memh); @@ -697,7 +697,7 @@ static Bitu INT67_Handler(void) { Bitu i; switch (reg_ah) { case 0x40: /* Get Status */ - reg_ah=EMM_NO_ERROR; + reg_ah=EMM_NO_ERROR; break; case 0x41: /* Get PageFrame Segment */ reg_bx=EMM_PAGEFRAME; @@ -754,7 +754,7 @@ static Bitu INT67_Handler(void) { MEM_BlockWrite(SegPhys(es)+reg_di,emm_mappings,sizeof(emm_mappings)); MEM_BlockRead(SegPhys(ds)+reg_si,emm_mappings,sizeof(emm_mappings)); reg_ah=EMM_RestoreMappingTable(); - break; + break; case 0x03: /* Get Page Map Array Size */ reg_al=sizeof(emm_mappings); reg_ah=EMM_NO_ERROR; @@ -780,7 +780,7 @@ static Bitu INT67_Handler(void) { if (reg_ah!=EMM_NO_ERROR) break; }; } break; - case 0x01: // use segment address + case 0x01: // use segment address { PhysPt data = SegPhys(ds)+reg_si; for (int i=0; i>16; @@ -981,8 +981,8 @@ static Bitu INT67_Handler(void) { /* Load tables and initialize segment registers */ CPU_LGDT(new_gdt_limit, new_gdt_base); CPU_LIDT(new_idt_limit, new_idt_base); - if (CPU_LLDT(new_ldt)) LOG_MSG("VCPI:Could not load LDT with %x",new_ldt); - if (CPU_LTR(new_tr)) LOG_MSG("VCPI:Could not load TR with %x",new_tr); + if (CPU_LLDT(new_ldt)) LOG_MSG("VCPI: Could not load LDT with %x",new_ldt); + if (CPU_LTR(new_tr)) LOG_MSG("VCPI: Could not load TR with %x",new_tr); CPU_SetSegGeneral(ds,0); CPU_SetSegGeneral(es,0); @@ -1050,8 +1050,8 @@ static Bitu VCPI_PM_Handler() { /* Load descriptor table registers */ CPU_LGDT(0xff, vcpi.private_area+0x0000); CPU_LIDT(0x7ff, vcpi.private_area+0x2000); - if (CPU_LLDT(0x08)) LOG_MSG("VCPI:Could not load LDT"); - if (CPU_LTR(0x10)) LOG_MSG("VCPI:Could not load TR"); + if (CPU_LLDT(0x08)) LOG_MSG("VCPI: Could not load LDT"); + if (CPU_LTR(0x10)) LOG_MSG("VCPI: Could not load TR"); reg_flags&=(~FLAG_NT); reg_esp+=8; // skip interrupt return information @@ -1322,7 +1322,7 @@ public: vcpi.enabled=false; GEMMIS_seg=0; - + Section_prop * section=static_cast(configuration); ems_type=GetEMSType(section); if (ems_type<=0) return; @@ -1399,8 +1399,8 @@ public: CPU_SET_CRX(0, 1); CPU_LGDT(0xff, vcpi.private_area+0x0000); CPU_LIDT(0x7ff, vcpi.private_area+0x2000); - if (CPU_LLDT(0x08)) LOG_MSG("VCPI:Could not load LDT"); - if (CPU_LTR(0x10)) LOG_MSG("VCPI:Could not load TR"); + if (CPU_LLDT(0x08)) LOG_MSG("VCPI: Could not load LDT"); + if (CPU_LTR(0x10)) LOG_MSG("VCPI: Could not load TR"); CPU_Push32(SegValue(gs)); CPU_Push32(SegValue(fs)); @@ -1416,13 +1416,13 @@ public: } } } - + ~EMS() { if (ems_type<=0) return; /* Undo Biosclearing */ BIOS_ZeroExtendedSize(false); - + /* Remove ems device */ if (emm_device!=NULL) { DOS_DelDevice(emm_device); @@ -1455,11 +1455,11 @@ public: } } }; - + static EMS* test; void EMS_ShutDown(Section* /*sec*/) { - delete test; + delete test; } void EMS_Init(Section* sec) { diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index c8d4cfa2..a8dde5fb 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -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;