ECHO OFF
SET DR=%1
CLS
ECHO JOCF.BAT is John Orlay's Cataloger for Floppies    Please read JOCX.DOC
ECHO ~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~
REM  ------------------------------------------------------------------------
:SYNTAX
REM  Now checking syntax
IF NOT %1=="" GOTO DRIVE
ECHO  You forgot to state the drive-parameter !  You must read JOCX.DOC !  
ECHO  The correct syntax at the DOS prompt is           JOCF drive:
ECHO              for example, to catalog drive A:      JOCF A:
GOTO END
REM  ------------------------------------------------------------------------
:DRIVE
ECHO  You specified drive %DR% as the one to be cataloged
ECHO.
ECHO  If %DR% is the drive from which you have invoked JOCF then abort now
ECHO        by entering  two CtrlC-s   Then read JOCX.DOC again !!!
ECHO.
ECHO  If %DR% is a floppy-drive then insert the floppy to be cataloged and
ECHO
PAUSE
REM  ------------------------------------------------------------------------
:VOLUME
ECHO    Now checking whether the disk in drive %DR% has an internal label.
ECHO             IT IS ABSOLUTELY ESSENTIAL TO HAVE SUCH A LABEL
ECHO IF IT DOES NOT EXIST OR IF WRONG, YOU WILL GET AN OPPORTUNITY TO MAKE ONE 
ECHO.
DIR %DR% | FIND "Volume"
ECHO  PLEASE READ THE ABOVE LINE AND ACT AS FOLLOWS :
ECHO If %DR% has an internal label then press key 0 and then the ENTER/RETURN key
ECHO If %DR% has no internal label then press key 1 and then the ENTER/RETURN key
ECHO If you want a different label then press key 1 and then the ENTER/RETURN key
ANSWER
IF %ANSWER%==0 GOTO TREE
IF %ANSWER%==1 GOTO LABEL
ECHO You made an error.  Your choice "%ANSWER%" is illegal !
GOTO VOLUME
REM --------------------------------------------------------------------------
:LABEL
CLS
ECHO This program requires an internal label on the diskette in drive %DR
ECHO                       and will enable you to make a label, or change it.
ECHO                       There must be no "write-protect-sticker" on the disk
ECHO                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PAUSE
LABEL %DR%
REM --------------------------------------------------------------------------
:TREE
ECHO Now making TR.DAT
REM               Looking at disk in drive %DR%
REM               Creates (in current directory) TR.DAT which will consist of :
REM                   Line  1         Volume Label of disk
REM                   Line  2         %DR%     (= drive)
REM                   Lines 3 - end   Pathnames of all directories on %DR%
TREE %DR% > RAWTREE
FIND "FOR VOLUME" RAWTREE > TR1
CHANGE TR1 "DIRECTORY PATH LISTING FOR VOLUME " "" > NUL
ECHO Path: %DR%>> TR1
FIND "Pa" RAWTREE >> TR1 
FIND /V "RAWTREE" TR1 > TR.DAT
CHANGE TR.DAT "---------- TR1" "" > NUL
CHANGE TR.DAT 13,10,13,10 13,10   > NUL
CHANGE TR.DAT "Path: " ""         > NUL
CHANGE TR.DAT 13,10,13,10 ""      > NUL
DEL RAWTREE
DEL TR1
ECHO TR.DAT file created
REM -------------------------------------------------------------------------
REM  Now making C.BAT
GWBASIC M-CBAT
ECHO C.BAT made
REM -------------------------------------------------------------------------
ECHO Now executing C.BAT which makes CRCLOG.DAT and FILELOG.DAT
ECHO                           then executes M-FLDAT.BAT,  which - in turn -
ECHO                                then filters FILELOG.DAT to FL.DAT
ECHO                                then executes DC.BAS to make DC.DAT
ECHO                                then echoes DC.DAT on the screen
ECHO                                and finally deletes all other .DAT files
ECHO.
ECHO Be patient, CRC32 calculations take about 3 minutes per Mb at  4.77 MHz
ECHO ~~~~~~~~~~                       or about 1 minute  per Mb at 16    MHz
C
REM -------------------------------------------------------------------------
:END
