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

rem DVItoCM:
  if not exist %EMTEXDIR%\fonts\vf-cnv\cs2cm\csr10.vf goto sorry
  set MARK=%TEXFONTS%
  set TEXFONTS=%EMTEXDIR%\tfm\\
  set TEXVFONTS=%EMTEXDIR%\fonts\vf-cnv\cs2cm
  dvicopy %MAIN% < nul
  set TEXFONTS=%MARK%
  set TEXVFONTS=
  set MNU=130
  set MARK=
  if errorlevel 1 set MARK=pause
  if errorlevel 1 mnu %EMTEXDIR%\mnu\sorry.mnu
  %MARK% copy %MAIN%.cpy %MAIN%.dvi
  del %MAIN%.cpy
  set MNU=131
  goto end

:dvips
  if not exist %EMTEXDIR%\bin\%DVIPSVER%.exe goto sorry
  dvidrv %DVIPSVER% -a %MAIN%
  goto end

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

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

:texcad
  if not exist %EMTEXDIR%\bin\texcad.exe goto sorry
  %EMTEXDIR%\bin\texcad
  goto end

:gsview
  if not exist %EMTEXDIR%\bin\gs386.exe goto sorry
  %EMTEXDIR%\bin\gs386 -I%EMTEXDIR%\gslib %MAIN%.ps > gs.log
goto end

rem  Zde lze analogicky zaradit dalsi software.

:sorry
  %EMTEXDIR%\bin\mnu %EMTEXDIR%\mnu\sorry.mnu
:end


