@echo off & setlocal enableextensions & echo.

if "%1" neq "" goto getpar

:usage
   echo finish.bat copies general files to Confor output folders,
   echo clears archive attributes in those folders, deletes temporary files,
   echo and converts file names to lower case.
   echo    Usage: FINISH language
   echo where 'language' is 'en' or 'fr'.
exit /b 1

:getpar
if "%1" equ "/?" goto usage
for %%p in (en EN) do if %%p==%1 goto en
for %%p in (fr FR) do if %%p==%1 goto fr
goto usage

:en
set lan=en
goto start

:fr
set lan=fr
goto start

:start

echo Copying general 'caes' files and tidying.

set w=%lan%\www
set i=%lan%\info

call chkdir_ %w% || goto abort
call chkdir_ %i% || goto abort

set copfil_=0
call copfiq_ style.css %w%
call copfiq_ style.css %lan%
call copfiq_ deltlogo.gif %w%
call copfiq_ deltlogo.gif %lan%


echo.

call copfiq_ ack.htm %lan%
call copfiq_ changes.htm %lan%
call copfiq_ class.htm %lan%
call copfiq_ contacts.htm %lan%
call copfiq_ intro.htm %lan%
call copfiq_ refs.htm %lan%
call copfiq_ sample.htm %lan%
call copfiq_ intkey.ink %lan%
call copfiq_ *.inp %lan%

if %copfil_% neq 0 goto abort

attrib -a %lan%\*.* > nul
attrib -a %w%\*.* > nul
attrib -a %i%\*.* > nul

if exist *.bak del *.bak > nul
if exist *.lst del *.lst > nul
if exist *.tmp del *.tmp > nul
if exist *.wbk del *.wbk > nul
if exist temp.* del temp.* > nul
if exist temp_files\ rd /s/q temp_files
call lcase

goto end

:abort
exit /b 1

:end
exit /b 0
