@echo off

rem *** This is an example batch file to demonstrate using ARCHID 2.41.   ***
rem *** I do NOT recommend using this kind of PCBTEST file,               ***
rem *** this is just an example to show how to use it.                    ***

archid %3 arj zip rar lha lharc uc2 arj-x zip-x zjr-x rar-x lha-x lhc-x
rem *** (to prevent complexity of this example,                           ***
rem ***  we will not accept other archives than those...)                 ***

if errorlevel 255 goto nonarc
rem *** (not recognized nor supported)  ***
if errorlevel 249 goto critical
rem *** (some other internal error)     ***
if errorlevel 12 goto lha
if errorlevel 11 goto lha
if errorlevel 10 goto rar
if errorlevel  9 goto zip
if errorlevel  8 goto zip
if errorlevel  7 goto arj
if errorlevel  6 goto uc2
if errorlevel  5 goto lha
if errorlevel  4 goto lha
if errorlevel  3 goto rar
if errorlevel  2 goto zip
if errorlevel  1 goto arj

:ARJ
arj t %3
if errorlevel 1 goto corrupted
goto end

:ZIP
pkunzip -t %3
if errorlevel 1 goto corrupted
goto end

:RAR
rar t -std %3
if errorlevel 1 goto corrupted
goto end

:LHA
lha t %3
if errorlevel 1 goto corrupted
goto end

:UC2
uc t %3
if errorlevel 1 goto corrupted
goto end

:corrupted
echo @X04File corrupted: @X0C%2 >pcbfail.txt
goto end

:nonarc
echo Non-archive or not supported by this system: %2 >pcbpass.txt
goto end

:critical
echo @X04Critical archive testing error. Report to SysOp! >pcbpass.txt

:end
