Metropoli BBS
VIEWER: fixauto.cmd MODE: TEXT (ASCII)
/*****************/
/* Get arguments */
/*****************/

'@echo off'

Parse Arg all

If words(all) = 2 then do
    Dstdrv = translate(word(all,1))
    Action = translate(word(all,2))
    end
else signal ERROREXIT

/**********************************/
/* add fixvga.exe to AUTOEXEC.BAT */
/**********************************/

InnF=Dstdrv'\AUTOEXEC.MGA'
OutF=Dstdrv'\AUTOEXEC.BAT'

'copy 'OutF' 'InnF' >nul'
'del 'OutF

call lineout OutF, '@ECHO OFF'
if Action = 'OFF' then signal REMOVEMGA

/* call lineout OutF, Dstdrv'\MGA\OS2\FIXVGA.EXE' */
call lineout OutF, 'SET MGA='Dstdrv'\MGA\OS2'

REMOVEMGA:

do until lines(InnF) = 0
    InStr = linein(InnF)
    select
	when pos('ECHO OFF', InStr) > 0 	then nop
	when pos('FIXVGA.EXE', InStr) > 0	then nop
	when pos(':\OS2\MODE CO80', InStr) > 0	then nop
	when pos('SET MGA=', InStr) > 0 	then nop
	otherwise call lineout OutF, InStr
    end
end

call stream OutF, 'c', 'close'
call stream InnF, 'c', 'close'

ERROREXIT:
[ RETURN TO DIRECTORY ]