rem ... the "subroutine batch" called from TEXBAT.BAT
if errorlevel 136 goto gsview
if errorlevel 135 goto texcad
if errorlevel 134 goto bibtex
if errorlevel 133 goto makein
if errorlevel 132 goto dvips
if errorlevel 131 goto dviout
goto end

:dviout
 if not exist %TEXDIR%\dvi-out.exe goto sorry
 %TEXDIR%\dvi-out %MAIN%
 set MNU=130
 if errorlevel 1 pause
 if errorlevel 1 %RAM%\mnu %TEXDIRCFG%\sorry.mnu
 set MNU=131
 goto end

:dvips
 if not exist %TEXDIR%\dvips.exe goto sorry
 %TEXDIR%\dvi-out -m %MAIN%
 if errorlevel 1 pause
 %TEXDIR%\dvips -a %MAIN%
 goto end

:makein
 if not exist %TEXDIR%\csindex.exe goto sorry
 %TEXDIR%\csindex %INDEXOPT% %MAIN%
 goto end

:bibtex
 if not exist %TEXDIR%\csbibtex.exe goto sorry
 %COMSPEC% /c%TEXDIR%\csbibtex %BIBTEXOPT% %MAIN%
 goto end

:texcad
 if not exist %TEXDIR%\texcad\texcad.exe goto sorry
 echo Pozor. Pri prvnim vyvolani programu TEXCAD musite uvest cestu pro BGI:
 echo     %TEXDIR%\texcad
 echo Tento udaj zopakujte a ulozte uvnitr programu v nabidce OPTIONS
 %TEXDIR%\texcad\texcad
 goto end

:gsview
 %TEXDIR%\gs -I%TEXDIR%\gslib %MAIN%.ps > nul
 goto end

rem  Zde lze analogicky zaradit dalsi software.

:sorry
 %RAM%\mnu %TEXDIRCFG%\sorry.mnu
:end