@echo off
REM /////////////////////////////////////////////
REM This is a sample TestUpload.Cmd for AdeptXBBS
REM It does minimal _anything_ it shows how you
REM might judge how to test a certain file. It
REM does show you how to create the file which
REM tells AdeptXBBS that an error occured
REM /////////////////////////////////////////////

REM //////////////////////////////////////////
REM Command line parms are as follows:
REM %1 = Complete filename to work on
REM %2 = Line number
REM %3 = Com port file handle
REM %4 = Just filename (no path, no extension)
REM %5 = Just extension
REM %6 = Just Drive:Path
REM //////////////////////////////////////////

IF %5==ZIP GOTO ZIP
IF %5==zip GOTO ZIP
IF %5==LZH GOTO LZH
IF %5==lzh GOTO LZH
IF %5==ARC GOTO ARC
IF %5==Arc GOTO ARC
IF %5==RAR GOTO RAR
IF %5==rar GOTO RAR
IF %5==ARJ GOTO ARJ
IF %5==arj GOTO ARJ
IF %5==ZOO GOTO ZOO
IF %5==zoo GOTO ZOO

REM /////////////////////////////////////////
REM there is no method
REM known which can test this file
REM So we will just delete the error file
REM should it exist for some one in a billion
REM reason.... doesn't hurt.. does it?
REM we could also skip to the virus scanning
REM portion.. if any
REM /////////////////////////////////////////
DEL %4.%5.Error
GOTO ENDHERE

:ZIP
@echo on
REM ////////////////
REM Test a ZIP file
REM ////////////////
unzip -t %1
@echo off
IF ERRORLEVEL 1 GOTO Error
GOTO NoError

:LZH
REM ////////////////
REM Test a LZH file
REM ////////////////
LH T %1
IF ERRORLEVEL 1 GOTO Error
GOTO NoError

:ARC
REM ////////////////
REM Test a ARC file
REM ////////////////
arc t %1
IF ERRORLEVEL 1 GOTO Error
GOTO NoError

:RAR
REM ////////////////
REM Test a ARC file
REM ////////////////
rar t %1
IF ERRORLEVEL 1 GOTO Error
GOTO NoError

:ARJ
REM ////////////////
REM Test a ZIP file
REM ////////////////
UNARJ T %1
IF ERRORLEVEL 1 GOTO Error
GOTO NoError

:ZOO
REM ////////////////
REM Test a ZIP file
REM ////////////////
ZOO -test %1
IF ERRORLEVEL 1 GOTO Error
GOTO NoError

:Error
REM ///////////////////////////////////
REM Note: The word ERROR is echoed into
REM the file. This is not a necessity.
REM The file simply needs to exist.
REM ///////////////////////////////////
ECHO ERROR >%4.%5.Error
EXIT

:NoError
REM ///////////////////////////////////////
REM at this point, the archive passed the
REM error test, now you could test the
REM file contents with a virus scanner,
REM or any other test you might like.
REM The sample takes the easy way out and
REM exits.
REM ///////////////////////////////////////
GOTO ENDHERE

:ENDHERE
