@echo off & setlocal enableextensions

echo.
if not '%1'=='' goto getpar

:usage
echo Generates files in the 'rtf' folders.
echo Usage: RUNLANR language
echo where 'language' is de, en, es, or fr.
goto finish

:getpar
for %%p in (de DE) do if %%p==%1 goto de
for %%p in (en EN) do if %%p==%1 goto en
for %%p in (es ES) do if %%p==%1 goto es
for %%p in (fr FR) do if %%p==%1 goto fr
goto usage

:de
set lan=de
goto start

:en
set lan=en
goto start

:es
set lan=es
goto start

:fr
set lan=fr
goto start

:start

call chkdiq_ %lan% || md %lan%
call chkdir_ %lan% || goto abort
call chkdiq_ %lan%\rtf || md %lan%\rtf

echo.
echo ==============================================================================
echo ===== %lan% =====================================================================
echo ==============================================================================
echo.

echo Confor printcr.%lan%
call confor printcr.%lan% || goto abort
echo Confor printcrx.%lan%
call confor printcrx.%lan% || goto abort
echo Confor tonatr.%lan%
call confor tonatr.%lan% || goto abort
echo Confor printnr.%lan%
call confor printnr.%lan% || goto abort

call finish %lan% || goto abort
goto finish

:abort
echo.
echo  ****** 'runlanr.bat %lan%' failed.
exit /b 1

:finish
echo.
exit /b 0
