@echo off

REM  *************************************************************************
REM  Edited 11-26-94, to comply with the new 3.0 reader.
REM  No longer adds SWAGCOMP.EXE to SWAG.ZIP, per NEWFOR.300
REM  Now adds SWAG.EXE, SWAGV.EXE to SWAG.ZIP, per NEWFOR.300
REM  Also adds BXP03A.ZIP, and XX3402.ZIP to SWAG.ZIP, since these
REM    were previously only available in ALLSWAGS.ZIP.
REM  Also adds NEWFOR.300 to SWAG.ZIP
REM  Also, copies each .DIZ to the %2 directory, so they get added.
REM  Now adds ALL .TXT files to SWAG.ZIP.
REM
REM  Don Krause, the Squirrel's Nest BBS.
REM
REM  Above modifications were done, so that people that have to get SWAGs
REM  in pieces, (ie: SWAG.ZIP  SWAGA-C.ZIP etc) get ALL the goodies
REM  that are in ALLSWAGS.ZIP
REM  *************************************************************************

REM  COMPLIMENTS TO FRANK DIACHEYSN FOR MODIFYING THIS FILE TO WORK WITH
REM  ZIP AND ARJ FORMATS

REM  SUPPORT.BAT
REM  Packs archive files SWAGX-Y using current .SWG files,
REM  Support sites DO NOT have to download the ENTIRE SWAG files package
REM  with each release.  All that is necessary is to download SWAGYYMM.ZIP
REM  OR ALLSWAGS.ZIP.  SWAGYYMM.ZIP can be used to update the current copy
REM  of ALLSWAGS.ZIP that the support site has.  Once this is done, the
REM  smaller support archives can be created with this batch file.

REM  This makes it easy for Support sites to download ONLY the SWAG update
REM  or the ALLSWAGS.ZIP and create the five supporting archives.
REM
REM  There are TWO varibles needed with this batch file.
REM  %1 is the directory location of your SWAG ZIP files.
REM  %2 is the directory location of your *.SWG files.
REM  %3 [ARJ] is optional and makes support.bat use ARJ instead of PkZip
REM  therefore, call this for DOS : support [swagzips] [swagfiles] [ARJ]

IF "%1" == "" GOTO SYNTAX
IF "%2" == "" GOTO SYNTAX
IF "%3" == "ARJ" GOTO ARJ
IF "%3" == "arj" GOTO ARJ

IF EXIST %1\file_id.diz COPY %1\file_id.diz %1\support.diz
REM  Create SWAG.ZIP
IF EXIST %1\swag.zip DEL %1\swag.zip
COPY swag.diz %2\file_id.diz

REM Modified 11-29-94
REM PKZIP -ex %1\swag.zip %2\reader.exe %2\bbs.txt %2\swag.txt %2\reader.doc %2\file_id.diz %2\swagcomp.exe
PKZIP -ex %1\swag.zip %2\reader.exe %2\*.txt %2\reader.doc %2\file_id.diz 
PKZIP -ex %1\swag.zip %2\swag.exe %2\swagv.exe %2\bxp03a.zip %2\xx3402.zip %2\newfor.300

REM  Create SWAGA-C.ZIP
IF EXIST %1\swaga-c.zip DEL %1\swaga-c.zip
COPY swaga-c.diz %2\file_id.diz
PKZIP -ex %1\swaga-c.zip %2\a*.swg %2\b*.swg %2\c*.swg %2\file_id.diz

REM  Create SWAGD-F.ZIP
IF EXIST %1\swagd-f.zip DEL %1\swagd-f.zip
COPY swagd-f.diz %2\file_id.diz
PKZIP -ex %1\swagd-f.zip %2\d*.swg %2\e*.swg %2\f*.swg %2\file_id.diz

REM  Create SWAGG-M.ZIP
IF EXIST %1\swagg-m.zip DEL %1\swagg-m.zip
COPY swagg-m.diz %2\file_id.diz
PKZIP -ex %1\swagg-m.zip %2\g*.swg %2\h*.swg %2\i*.swg %2\file_id.diz -x%2\grepswag.*
PKZIP -ex %1\swagg-m.zip %2\j*.swg %2\k*.swg %2\l*.swg %2\m*.swg -x%2\grepswag.*

REM  Create SWAGN-R.ZIP
IF EXIST %1\swagn-r.zip DEL %1\swagn-r.zip
COPY swagn-r.diz %2\file_id.diz
PKZIP -ex %1\swagn-r.zip %2\n*.swg %2\o*.swg %2\p*.swg %2\q*.swg %2\r*.swg %2\file_id.diz

REM  Create SWAGS-Z.ZIP
IF EXIST %1\swags-z.zip DEL %1\swags-z.zip
COPY swags-z.diz %2\file_id.diz
PKZIP -ex %1\swags-z.zip %2\s*.swg %2\t*.swg %2\u*.swg %2\v*.swg %2\w*.swg
PKZIP -ex %1\swags-z.zip %2\x*.swg %2\y*.swg %2\z*.swg %2\file_id.diz

REM  Create ALLSWAGS.ZIP  //Added 11-26-94
IF EXIST %1\a;;swags.zip DEL %1\allswags.zip
COPY allswags.diz %2\file_id.diz
PKZIP -ex %1\allswags.zip %2\*.*

GOTO END

:ARJ

IF EXIST %1\file_id.diz COPY %1\file_id.diz %1\support.diz
REM  Create SWAG.ARJ
IF EXIST %1\swag.arj DEL %1\swag.arj
COPY swag.diz %2\file_id.diz

REM  Modified 11-26-94
REM  arj a %1\swag.arj %2\reader.exe %2\bbs.txt %2\swag.txt %2\reader.doc %2\file_id.diz %2\swagcomp.exe
arj a %1\swag.arj %2\reader.exe %2\* %2\reader.doc %2\file_id.diz
arj a %1\swag.arj %2\swag.exe %2\swagv.exe %2\bxp03a.zip %2\xx3402.zip %2\newfor.300

REM  Create SWAGA-C.arj
IF EXIST %1\swaga-c.arj DEL %1\swaga-c.arj
COPY swaga-c.diz %2\file_id.diz
arj a %1\swaga-c.arj %2\a*.swg %2\b*.swg %2\c*.swg %2\file_id.diz

REM  Create SWAGD-F.arj
IF EXIST %1\swagd-f.arj DEL %1\swagd-f.arj
COPY swagd-f.diz %2\file_id.diz
arj a %1\swagd-f.arj %2\d*.swg %2\e*.swg %2\f*.swg %2\file_id.diz

REM  Create SWAGG-M.arj
IF EXIST %1\swagg-m.arj DEL %1\swagg-m.arj
COPY swagg-m.diz %2\file_id.diz
arj a %1\swagg-m.arj %2\g*.swg %2\h*.swg %2\i*.swg %2\file_id.diz -x%2\grepswag.*
arj a %1\swagg-m.arj %2\j.swg %2\k*.swg %2\l*.swg %2\m*.swg -x%2\grepswag.*

REM  Create SWAGN-R.arj
IF EXIST %1\swagn-r.arj DEL %1\swagn-r.arj
COPY swagn-r.diz %2\file_id.diz
arj a %1\swagn-r.arj %2\n*.swg %2\o*.swg %2\p*.swg %2\q*.swg %2\r*.swg %2\file_id.diz

REM  Create SWAGS-Z.arj
IF EXIST %1\swags-z.arj DEL %1\swags-z.arj
COPY swags-z.diz %2\file_id.diz
arj a %1\swags-z.arj %2\s*.swg %2\t*.swg %2\u*.swg %2\v*.swg %2\w*.swg
arj a %1\swags-z.arj %2\x*.swg %2\y*.swg %2\z*.swg %2\file_id.diz

REM  Create ALLSWAGS.arj  // Added 11-26-94
IF EXIST %1\allswags.arj DEL %1\allswags.arj
COPY allswags.diz %2\file_id.diz
arj a %1\allswags.arj %2\*.*

GOTO END

:SYNTAX
ECHO SUPPORT.BAT Create SWAG Support ZIPS from *.SWG Files
ECHO Third parameter "[ARJ]" is optional and creates ARJs instead of ZIPs
ECHO SYNTAX: SUPPORT [swagZIPpath] [swagFILESpath] [ARJ]

ECHO   e.g. "SUPPORT \swag\zips \swag\files"

:END

IF EXIST %1\file_id.diz DEL %1\file_id.diz
IF EXIST %1\support.diz REN %1\support.diz %1\file_id.diz
