@echo off
rem ---------------------------
rem  arcall.bat for Red Planet
rem ---------------------------
set c1=%2
if "%c1%"=="" set c1=%PODBAYON%\%VCSID%
set c2=RPALL.ZIP
set c3=*.*
set d0=$$arcall.tmp
set v0=
if "%1"=="-c" set v0=a
if "%1"=="-C" set v0=a
if "%1"=="-u" set v0=u
if "%1"=="-U" set v0=u
if "%v0%"=="" goto USAGE

:Check
if not "%2"=="" goto CheckDirectory
if "%PODBAYON%"=="" goto NO_PODBAYON
if "%VCSID%"=="" goto NO_VCSID
:CheckDirectory
echo.>%c1%\%d0%
if not exist %c1%\%d0% goto BAD_DIRECTORY
del %c1%\%d0%

:Process
set v1=process
if "%v0%"=="a" set v1=creat
if "%v0%"=="u" set v1=updat
echo.
echo %v1%ing %c1%\%c2%
echo.

:Exclude
echo wattcp.cfg>%d0%
echo joystick.ini>>%d0%
echo vrend?.btl>>%d0%
echo *.zip>>%d0%
echo *.??->>%d0%
echo *.bak>>%d0%
echo *.tr2>>%d0%

:Archive
if "%v0%"=="a" if exist %c1%\%c2% del %c1%\%c2%
echo on
pkzip.exe -%v0% -eX -r -P -x@%d0% %c1%\%c2% %c3%
@echo off
echo done.
goto END

:NO_PODBAYON
echo.
echo Environment variable PODBAYON required for default directory.
echo.
goto END

:NO_VCSID
echo.
echo Environment variable VCSID required for default directory.
echo.
goto END

:BAD_DIRECTORY
echo.
echo Error - Can't write to directory '%c1%'.  Check network drive.
echo.
goto END

:USAGE
echo.
echo usage:  arcall  option  [destination]
echo.
echo           option '-c' - create (overwrite) %c1%\%c2%
echo                  '-u' - update (freshen)   %c1%\%c2%
echo           destination is drive and/or directory for archive file
echo.
goto END

:END
if exist %d0% del %d0%
set c1=
set c2=
set c3=
set d0=
set v0=
set v1=
