@echo off
if not "%1" == "/*" goto aa
if "%2" == "..1.12" goto us1
cls
:usage
echo - For use with FWKCS(TM) Contents_Signature System, Version 1.12.
echo - (C)Copyright Frederick W. Kantor 1991. All rights reserved.
echo -
:us1
echo - S_SETUP.BAT to install the FWKCS(TM) Contents_Signature System,
echo -     searching for non_directory files,
echo -     including specified drive(s)(A-Z)  and  file extension(s) or string(s).
echo - (Note: this does not install options g and z. See SETUP.112, FWKCS112.REF.)
echo -
echo - Usage:  S_SETUP d n D N q r s t v - .Z .GIF :\UP\ x .SYS "<enter>"
echo -         S_SETUP d n D N q r s t v - : x \DOS\ "<enter>"
echo -
echo - d  without a ":" is drive for the \CS Contents_Signature subdirectory.
echo - n = 1 include only zipfiles, any or no extension, self_extracting or not.
echo -     2 include all accessible non_directory files.
echo - D  without a ":" is drive for the \CSA Contents_Signature Activity place.
echo - N = 1 single user, no bulletin board system.
echo -     2 single local user, with (multi_node) bulletin board system.
echo -     3 multiple local users, with (multi_node) bulletin board system.
echo - q r s t v  indicate single letters for drives to search.
echo - "-" is literal, followed in CAPITAL LETTERS by extensions (with "."), or
echo -      other strings, to include.  N.B.: do not use 2 paths to same file.
echo - ":" in " - : " means "all non_directory files" (may include hidden/system).
echo - "x" in lower_case is literal, followed in CAPITAL LETTERS by exclusion list.
if "%1" == "/*" goto us2
goto ng
:aa
if not exist fwkcs112.zip goto nd
if "%1" == "" goto help1
if "%2" == "1" goto ab
if "%2" == "2" goto ab
goto help2
:ab
if "%3" == "" goto help3
if "%4" == "1" goto bb
if "%4" == "2" goto bb
if "%4" == "3" goto bb
goto help4
:bb
if "%5" == "" goto help5
if "%5" == "-" goto help5
md %1:\cs > nul
echo TEST > %1:\cs\!@#^#@!@.tmp
if not exist %1:\cs\!@#^#@!@.tmp goto nmd1
del %1:\cs\!@#^#@!@.tmp > nul
md %3:\csa > nul
echo TEST > %3:\csa\!@#^#@!@.tmp
if not exist %3:\csa\!@#^#@!@.tmp goto nmd2
del %3:\csa\!@#^#@!@.tmp > nul
rd %3:\csa > nul
if exist #@!#@!^^.@!@ attrib -r #@!#@!^^.@!@ > nul
if exist #@!#@!^^.@!@ del #@!#@!^^.@!@ > nul
if exist @@!#@!^^.@!@ attrib -r @@!#@!^^.@!@ > nul
if exist @@!#@!^^.@!@ del @@!#@!^^.@!@ > nul
echo sort test > #@!#@!^^.@!@
qsort #@!#@!^^.@!@ @@!#@!^^.@!@ > nul
del #@!#@!^^.@!@ > nul
if not exist @@!#@!^^.@!@ goto nsrt
cls
del @@!#@!^^.@!@ > nul
if exist !! attrib -r !! > nul
if exist !! del !! > nul
pkunzip -o fwkcs112 !! > nul
if not exist !! goto nz
pkunzip -o fwkcs112 %1:\cs @!! > nul
del !! > nul
%1:
cd %1:\cs
fwkcs %1:\cs\cslist.ndx /d1
fwkcs %1:\cs\cslist.srt /d2
fwkcs %1:\cs\cslist1.ndx /d3
fwkcs %1:\cs\cslist1.srt /d4
if exist worktemp del worktemp > nul
if exist worklist del worklist > nul
if exist cslist.ndx attrib -r cslist.ndx > nul
if exist cslist.srt attrib -r cslist.srt > nul
if exist cslist1.ndx attrib -r cslist1.ndx > nul
if exist cslist1.srt attrib -r cslist1.srt > nul
if exist cslist.ndx del cslist.ndx > nul
if exist cslist.srt del cslist.srt > nul
if exist cslist1.ndx del cslist1.ndx > nul
if exist cslist1.srt del cslist1.srt > nul
if exist #@!^!@#@.bat attrib -r #@!^!@#@.bat > nul
echo csamacs %3 %4 > #@!^!@#@.bat
if exist !@#^#@!@.#@! attrib -r !@#^#@!@.#@! > nul
if exist !@#^#@!@.#@! del !@#^#@!@.#@! > nul
if "%2" == "2" goto loop1
echo only zipfiles > !@#^#@!@.#@!
:loop1
if "%5" == "" goto help6
if "%5" == "-" goto extns
fwkdg %5 /l >>worktemp
shift
goto loop1
:extns
shift
if "%5" == "" goto help6
if "%5" == "x" goto help6
if "%5" == ":" goto all
:loop2
if "%5" == "" goto msrt
if "%5" == "x" goto msrt
find "%5" < worktemp >>worklist
shift
goto loop2
:msrt
if exist ^!_^!_^@.@#! attrib -r ^!_^!_^@.@#! > nul
if exist ^!_^!_^@.@#! del ^!_^!_^@.@#! > nul
qsort worklist ^!_^!_^@.@#!
del worklist > nul
del worktemp > nul
fwkcs ^!_^!_^@.@#! nul worklist /m
del ^!_^!_^@.@#! > nul
goto mx
:all
ren worktemp worklist > nul
:mx
type worktemp > worktemp
:loop3
shift
if "%5" == "" goto mcs
ren worklist ^!_^!_^@.@#! > nul
find /v "%5" < ^!_^!_^@.@#! > worklist
del ^!_^!_^@.@#! > nul
goto loop3
:mcs
if exist !@#^#@!@.#@! goto zf
fwkcs /1cfpxz worklist | qsort > cslist.srt
goto vcs
:zf
fwkcs /1cfxz worklist | qsort > cslist.srt
:vcs
fwkcs cslist.ndx cslist.srt /i
attrib +r cslist.ndx > nul
attrib +r cslist.srt > nul
cls
fwkcs /u
goto end1
:nd
echo -
echo - Did not find FWKCS112.ZIP
goto helpr
:nmd1
echo -
echo - Did not succeed in making %1:\CS.  Please check your system, and...
goto helpr
:nmd2
echo -
echo - Did not succeed in making %3:\CSA.  Please check your system, and...
goto helpr
:nsrt
echo -
echo - Where is Ben Baker's QSORT?
goto helpr
:nz
echo -
echo - Where is Phil Katz's PKUNZIP(R)?
goto helpr
:help1
echo -
echo - Where should I put the \cs subdirectory?
goto helpr
:help2
echo -
echo - I need a digit:  n = 1 only zipfiles. 2 all accessible non_directory files.
goto helpr
:help3
echo -
echo - Where should I put the Contents_Signature Activity \CSA place?
goto helpr
:help4
echo -
echo - I need a digit N (1 2 3) re system configuration.
goto helpr
:help5
echo -
echo - Which drive(s) should I search?
goto helpr
:help6
echo -
echo - For which extension(s) or string(s) should I search?
:helpr
echo -
echo -           Please try again.
echo -
goto usage
:end1
echo -
echo - Installed FWKCS(TM) Contents_Signature System files
echo -  cslist.ndx, cslist.srt, cslist1.ndx, and cslist1.srt
echo -  in the \cs contents_signature subdirectory.
if not exist !@#^#@!@.#@! goto zv
echo -  Only zip_format files were included.
:zv
echo -
echo - The on_line help menu for .BAT and .COM programs in the
echo - \CS Contents_Signature subdirectory is CSM.BAT.
echo -
echo -    To start it, type    CSM "<enter>"
echo -
echo - For on_line help from any .BAT or .COM program in the \CS subdirectory,
echo -
echo -    type    NAME /* "<enter>"  ,  where NAME is the program's name.
echo -
if exist worktemp del worktemp > nul
if exist worklist del worklist > nul
if exist !@#^#@!@.#@! del !@#^#@!@.#@! > nul
#@!^!@#@
:ng
if exist worktemp del worktemp > nul
if exist worklist del worklist > nul
if exist !@#^#@!@.#@! del !@#^#@!@.#@! > nul
:us2
echo -
if not "%2" == "..1.12" goto zz
if exist QUERYFLA.GUP attrib -r QUERYFLA.GUP > nul
if exist QUERYFLA.GUP del QUERYFLA.GUP > nul
:zz
