if not exist %EMTEXDIR%\bin\mnu.exe  goto konec
set MNU=2
set FFMT=
if exist %TMP%\@envir.bat  del %TMP%\@envir.bat

set MARK=b
if "%MFVER%"=="mf"    set MARK=
if "%MFVER%"=="mf186" set MARK=
if not exist %EMTEXDIR%\%MARK%mfbases\plain.bas set MNU=20

:start
  %EMTEXDIR%\bin\mnu %EMTEXDIR%\mnu\inibat.mnu %TMP%\@envir.bat
  if errorlevel 255 goto syserr
  if errorlevel 200 goto end
  if errorlevel 100 goto copyfmt
  if errorlevel 20  goto makebases
  call %TMP%\@envir
  set MNU=101
  call %EMTEXDIR%\mnu\texverze
  set MNU=13
  if `%FFMT%==`all goto allfmts
  rem *****************************
  call %EMTEXDIR%\mnu\makefmt %FMT%
  rem *****************************
  if exist %FMT%.fmt goto copyfmt
  set MNU=13
  goto start
:allfmts
  for %%t in (csPLAIN csLATEX csAMSTEX)    do call %EMTEXDIR%\mnu\makefmt %%t
  for %%t in (csLT209 csAMSLAT csLAMST csSLITEX) do call %EMTEXDIR%\mnu\makefmt %%t
  if exist *.fmt goto copyall
  set MNU=13
  goto start
:copyfmt
  call %EMTEXDIR%\mnu\copyfmt %FMT%
  set MNU=2
  goto start
:copyall
  for %%t in (csPLAIN csLATEX csAMSTEX)    do call %EMTEXDIR%\mnu\copyfmt %%t
  for %%t in (csLT209 csAMSLAT csLAMST csSLITEX) do call %EMTEXDIR%\mnu\copyfmt %%t
  set MNU=2
  goto start
:makebases
  call %EMTEXDIR%\mnu\inimf %MFVER%
  if "%MFJOBOPT%"==""     set MARK=mf
  if "%MFJOBOPT%"=="/1"   set MARK=mf186
  if "%MFJOBOPT%"=="/3"   set MARK=mf386
  if not "%MARK%"=="%MFVER%" call %EMTEXDIR%\mnu\inimf %MARK%
  set MNU=2
  goto start
:fsorry
  set MNU=102
:vsorry
  %EMTEXDIR%\bin\mnu %EMTEXDIR%\mnu\sorry.mnu
  set MNU=1
  goto start
:konec
  rem Tato davka neni samostatne spustitelna.
  rem Spousti se prostrednictvim davky INITEX.BAT
  goto end2
:syserr
  echo chyba nenˇ ve Va¨em p©ijˇma‡i, ale (bohu‘el) v konfiguraci syst‚mu
:end
del %TMP%\@*.bat
:end2
