@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_NEWCSL.BAT to make new cslist.ndx, cslist.srt, cslist1.ndx, cslist1.srt,
echo -     searching for non_directory files,
echo -     including specified drive(s)(A-Z)  and  file extension(s) or string(s).
echo -
echo - This is executed from within the \cs subdirectory. (see SETUP.112)
echo -
echo - Usage:  S_NEWCSL N q r s t v - .Z .GIF :\UP\ x .SYS "<enter>"
echo -         S_NEWCSL N q r s t v - : x \DOS\ "<enter>"
echo -
echo - N = 1 include only zipfiles, any or no extension, self_extracting or not.
echo -     2 include all accessible non_directory files.
echo -
echo - q r s t v  indicate single letters for drives to search.
echo -
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 -
echo - ":" in " - : " means "all non_directory files" (may include hidden/system).
echo -
echo - "x" in lower_case is literal, followed in CAPITAL LETTERS by exclusion list.
if "%1" == "/*" goto us2
goto ng
:aa
cls
if "%1" == "1" goto ab
if "%1" == "2" goto ab
goto help1
:ab
if "%2" == "" goto help2
if "%2" == "-" goto help2
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 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 !@#^#@!@.#@! attrib -r !@#^#@!@.#@! > nul
if exist !@#^#@!@.#@! del !@#^#@!@.#@! > nul
if "%1" == "2" goto loop1
echo only zipfiles > !@#^#@!@.#@!
:loop1
if "%2" == "" goto help3
if "%2" == "-" goto extns
fwkdg %2 /l >>worktemp
shift
goto loop1
:extns
shift
if "%2" == "" goto help3
if "%2" == "x" goto help3
if "%2" == ":" goto all
:loop2
if "%2" == "" goto msrt
if "%2" == "x" goto msrt
find "%2" < 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 "%2" == "" goto mcs
ren worklist ^!_^!_^@.@#! > nul
find /v "%2" < ^!_^!_^@.@#! > 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
fwkcs /u
goto end1
:nsrt
echo -
echo - Where is Ben Baker's QSORT?
goto helpr
:help1
echo -
echo - I need a digit:  N = 1 only zipfiles. 2 all accessible non_directory files.
goto helpr
:help2
echo -
echo - Which drive(s) should I search?
goto helpr
:help3
echo -
echo - For which extension(s) or string(s) should I search?
:helpr
echo -
echo -           Please try again.
echo -
goto usage
:end1
echo -
echo - Created new FWKCS(TM) Contents_Signature System files
echo -  cslist.ndx, cslist.srt, cslist1.ndx, and cslist1.srt
echo -  in this default subdirectory,
if not exist !@#^#@!@.#@! goto zv
echo -  including only zipfiles, any or no extension, self_extracting or not,
:zv
echo -  including only specified drive(s), file extension(s), and strings.
: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
