@ECHO OFF
IF %1. == .  GOTO USAGE
IF %1 == DOS GOTO DOIT
IF %1 == dos GOTO DOIT
IF %1 == win GOTO DOIT
IF NOT %1 == WIN GOTO USAGE
:DOIT
IF NOT EXIST inst.exe GOTO BADDRIVE
setcur >TEMP.BAT
CALL TEMP.BAT
inst
if NOT EXIST IBMCAD.BAT GOTO EARLYOUT
ECHO @ECHO OFF >^$)!%.BAT
TYPE IBMCAD.BAT |FIND "SET" >>^$)!%.BAT
CALL ^$)!%.BAT >NUL
DEL  ^$)!%.BAT >NUL
IF %IBMCADWORK%.==. GOTO BADNAME
if NOT EXIST %IBMCADSYS%\DATA.BAK GOTO DONE
ECHO ÿ
echo Installation completion in progress - please wait...
ECHO ÿ
IF EXIST %IBMCAD%:\IBM_CAD.EXE GOTO GOTNAME
COPY %IBMCAD%:\IBMINIT.EXE %IBMCADSYS% >NUL
%IBMCAD%:\setdrive
CALL %IBMCADWORK%\TEMP.BAT
cd %IBMCADSYS%
:WAITING
if EXIST IBMINIT.EXE GOTO GOTINIT
echo Waiting for IBMINIT.EXE . . .
GOTO WAITING
:GOTINIT
IBMINIT SETNAME
if errorlevel 5 GOTO NOMATH
if errorlevel 1 GOTO BADNAME
ERASE IBMINIT.EXE
ERASE NEWICFB.EXE
ERASE CAD4TH.LBR
ERASE %IBMCAD%:\IBMINIT.EXE
COPY IBM_CAD.EXE %IBMCAD%:\ >NUL
cd %IBMCADWORK%
GOTO DOWIN
:GOTNAME
COPY %IBMCAD%:\IBM_CAD.EXE %IBMCADSYS% >NUL
:DOWIN
SET IBMCAD=
echo @ECHO OFF >%IBMCADWORK%\IBMCAD.BAT
echo SET IBMCADSYS=%IBMCADSYS%>>%IBMCADWORK%\IBMCAD.BAT
echo SET IBMCADWORK=%IBMCADWORK%>>%IBMCADWORK%\IBMCAD.BAT
echo SET CGIPATH=%CGIPATH%>>%IBMCADWORK%\IBMCAD.BAT
echo SET MOUSE=>>%IBMCADWORK%\IBMCAD.BAT
echo MODE CO80 >>%IBMCADWORK%\IBMCAD.BAT
echo IF EXIST %IBMCADWORK%\EXECUTE.BAT ERASE %IBMCADWORK%\EXECUTE.BAT >>%IBMCADWORK%\IBMCAD.BAT
echo IF EXIST %IBMCADWORK%\BRDGEXEC.BAT ERASE %IBMCADWORK%\BRDGEXEC.BAT >>%IBMCADWORK%\IBMCAD.BAT
echo %IBMCADSYS%\ACCMENU %%1 >>%IBMCADWORK%\IBMCAD.BAT
echo IF EXIST %IBMCADWORK%\EXECUTE.BAT CALL %IBMCADWORK%\EXECUTE >>%IBMCADWORK%\IBMCAD.BAT
copy %IBMCADWORK%\IBMCAD.BAT C:\ >NUL
IF %1 == DOS GOTO FINI
IF %1 == dos GOTO FINI
%IBMCADWORK%\WINSETUP
:FINI
ECHO ÿ
ECHO ÿ
echo IBM CAD/3X installation complete !
ECHO ÿ
GOTO DONE
:USAGE
cls
ECHO ÿ
ECHO ÿ
echo To install IBM CAD for DOS, type:              INSTALL DOS
echo To install IBM CAD for DOS with WINDOWS icons: INSTALL WIN
ECHO ÿ
GOTO DONE
:BADDRIVE
cls
ECHO ÿ
ECHO ÿ
echo Please make the diskette drive the current drive and try again.
echo For example, if you have inserted the diskette into drive A:, type
ECHO ÿ
echo   A: (Enter)
echo   INSTALL DOS (Enter)
ECHO ÿ
GOTO DONE
:EARLYOUT
cls
ECHO ÿ
echo IBM CAD/3X has not been installed.
echo Either you have exited the install program early or you
echo have insufficient disk space.
ECHO ÿ
echo Please make sure that you have at lease 9 (nine) megabytes
echo of free disk space and install again.
ECHO ÿ
GOTO DONE
:BADNAME
cls
ECHO ÿ
ECHO ÿ
echo An error has occurred during the final installation step.
echo It was likely caused by a lack of free disk space.
ECHO ÿ
echo Please make sure that you have at lease 9 (nine) megabytes
echo of free disk space and install again.  There must also be
echo 1K of free disk space on your C: drive.
ECHO ÿ
GOTO DONE
:NOMATH
cls
ECHO ÿ
ECHO ÿ
echo A math co-processor error was detected!
ECHO ÿ
echo Either this machine does not contain a math co-processor
echo (or software emulator) or it is not functioning properly.
ECHO ÿ
echo Please correct this problem and re-install IBM CAD.
ECHO ÿ
:DONE
