REM --- SINSTALL.BAT -- INSTALLATION BATCH FILE FOR STATHELP
@ECHO OFF
CLS
IF %1!==! GOTO USAGE
IF %2!==! GOTO USAGE
IF %1==A: IF %1==%2 GOTO USAGE
IF %1==a: IF %1==%2 GOTO USAGE
IF %1==B: IF %1==%2 GOTO USAGE
IF %1==b: IF %1==%2 GOTO USAGE
IF %2==A: GOTO SPACE
IF %2==a: GOTO SPACE
IF %2==B: GOTO SPACE
IF %2==b: GOTO SPACE
GOTO CHK2DRIV
:SPACE
@ECHO ÿ
@ECHO     YOU HAVE ELECTED TO INSTALL THE STATHELP PROGRAMS ON A
@ECHO                   FLOPPY-DISK DRIVE, %2.
@ECHO ÿ
@ECHO          This is acceptable ONLY IF Drive %2 is A 3.5" Drive or a
@ECHO     High Density 5.25" Drive, with at least 470K bytes of free space.
@ECHO          If you haven't already done so, insert an empty FORMATTED
@ECHO     diskette in Drive %2, and be sure the door is closed.
@ECHO          Also be sure that the diskette is NOT WRITE-PROTECTED.
@ECHO ÿ
@ECHO                  Then press any key to continue
@ECHO  (or press [CTRL] & [BREAK] keys, together, to ABORT the installation.)
PAUSE>NUL
:CHK2DRIV
@ECHO ÿ
@ECHO   Checking Specified Drive to Install TO
@ECHO ECHO XXXX>%2\TEST.TXT
IF NOT EXIST %2\TEST.TXT GOTO BAD2DRIVE
DEL %2\TEST.TXT
@ECHO ÿ
@ECHO   OK -- TO_Drive exists -- Continuing
IF %2==A: GOTO CHKFROM
IF %2==a: GOTO CHKFROM
IF %2==B: GOTO CHKFROM
IF %2==b: GOTO CHKFROM
IF %3!==! GOTO SHDIR
@ECHO ÿ
@ECHO   Checking for existence of specified TO_Directory
@ECHO   (Ignore a "File creation error" message, if it appears)
@ECHO ECHO XXXX>%2%3\TEST.TXT
IF EXIST %2%3\TEST.TXT DEL %2%3\TEST.TXT GOTO CHKFROM 
@ECHO ÿ
@ECHO 
@ECHO   You have specified a directory, %3, that doesn't exist yet.
@ECHO   It will now be created, unless you choose to ABORT the installation
@ECHO   at this point.  To ABORT, simultaneously press the [CTRL] and [BREAK] 
@ECHO   keys, then answer Y (Yes) when DOS queries, "Terminate batch job?"
@ECHO   Otherwise, continue with the installation by pressing any other key.
PAUSE>NUL
@ECHO ÿ
@ECHO   Proceeding to create %3 Directory on Drive %2
MD %2%3
@ECHO ECHO XXXX>%2%3\TEST.TXT
IF NOT EXIST %2%3\TEST.TXT GOTO BAD2DIR
DEL %2%3\TEST.TXT
@ECHO ÿ
@ECHO   Directory %3 created on Drive %2
GOTO CHKFROM
:SHDIR
@ECHO ÿ
@ECHO   No To_Directory name specified -- default \STATHELP will be created
@ECHO   (Ignore a "File creation error" message, if it appears)
@ECHO ECHO XXXX>%2\STATHELP\TEST.TXT
IF EXIST %2\STATHELP\TEST.TXT DEL %2\STATHELP\TEST.TXT GOTO CHKFROM 
MD %2\STATHELP
@ECHO ECHO XXXX>%2\STATHELP\TEST.TXT
IF NOT EXIST %2\STATHELP\TEST.TXT GOTO BAD2DIR
DEL %2\STATHELP\TEST.TXT
:CHKFROM
@ECHO ÿ
@ECHO   Checking specified Drive to install FROM
IF NOT EXIST %1\SHZIPARC.EXE GOTO BADFROM
@ECHO ÿ
@ECHO   OK -- Archive file SHZIPARC.EXE found on Drive %1
@ECHO ÿ
@ECHO   Beginning installation -- The next series of messages will come from
@ECHO                             the self-executing archive file SHZIPARC.EXE
@ECHO ÿ
IF %2==A: GOTO TOFLOPPY
IF %2==a: GOTO TOFLOPPY
IF %2==B: GOTO TOFLOPPY
IF %2==b: GOTO TOFLOPPY
IF %3!==! %1SHZIPARC %2\STATHELP
IF %3!==! GOTO CHKDINST
%1SHZIPARC %2%3
IF NOT EXIST %2%3\WATSTAT.EXE GOTO ZIPERROR
IF NOT EXIST %2%3\WATSTAT.TXT GOTO ZIPERROR
IF NOT EXIST %2%3\WATSTAT.HLP GOTO ZIPERROR
IF NOT EXIST %2%3\WATSTAT.INX GOTO ZIPERROR
IF NOT EXIST %2%3\WATUT.EXE GOTO ZIPERROR
IF NOT EXIST %2%3\LOOKUP.EXE GOTO ZIPERROR
IF NOT EXIST %2%3\RANDO.EXE GOTO ZIPERROR
REM IF NOT EXIST %2%3\SHMANUAL.DOC GOTO ZIPERROR
GOTO ENJOY
:CHKDINST
IF NOT EXIST %2\STATHELP\WATSTAT.EXE GOTO ZIPERROR
IF NOT EXIST %2\STATHELP\WATSTAT.TXT GOTO ZIPERROR
IF NOT EXIST %2\STATHELP\WATSTAT.HLP GOTO ZIPERROR
IF NOT EXIST %2\STATHELP\WATSTAT.INX GOTO ZIPERROR
IF NOT EXIST %2\STATHELP\WATUT.EXE GOTO ZIPERROR
IF NOT EXIST %2\STATHELP\LOOKUP.EXE GOTO ZIPERROR
IF NOT EXIST %2\STATHELP\RANDO.EXE GOTO ZIPERROR
REM IF NOT EXIST %2\STATHELP\SHMANUAL.DOC GOTO ZIPERROR
GOTO ENJOY
:TOFLOPPY
%1SHZIPARC %2
IF ERRORLEVEL 50 GOTO OOPS
IF NOT EXIST %2\WATSTAT.EXE GOTO ZIPERROR
IF NOT EXIST %2\WATSTAT.TXT GOTO ZIPERROR
IF NOT EXIST %2\WATSTAT.HLP GOTO ZIPERROR
IF NOT EXIST %2\WATSTAT.INX GOTO ZIPERROR
IF NOT EXIST %2\WATUT.EXE GOTO ZIPERR0R
IF NOT EXIST %2\LOOKUP.EXE GOTO ZIPERROR
IF NOT EXIST %2\RANDO.EXE GOTO ZIPERROR
REM IF NOT EXIST %2\SHMANUAL.DOC GOTO ZIPERROR
:ENJOY
@ECHO ÿ
@ECHO  ************** INSTALLATION COMPLETED SUCCESSFULLY *******************
@ECHO ÿ
@ECHO    FINAL NOTES:
@ECHO ÿ
@ECHO   1) A mini-manual for the STATHELP programs, called SHMANUAL.DOC, has
@ECHO   been installed along with the program files.  SHMANUAL.DOC is a text
@ECHO   file, which you can read with any text editor or word processor.  
@ECHO   Or, make a hard copy of this file on your printer by typing:
@ECHO                      PRINT SHMANUAL.DOC   
@ECHO   from the DOS command line (after changing to the Drive and Directory
@ECHO   where SHMANUAL has just been installed).
@ECHO ÿ
@ECHO   2) To run any of the STATHELP programs, first change to the Drive
@ECHO   and Directory where they were just installed, and then type the name
@ECHO   of the program you want to run: WATSTAT, LOOKUP, or RANDO.
@ECHO ÿ
@ECHO  ************** WE TRUST THAT YOU'LL ENJOY STATHELP *******************
@ECHO ÿ
GOTO END
:BAD2DRIV
@ECHO ÿ
@ECHO 
@ECHO   DRIVE %2 COULD NOT BE ACCESSED & FILES COULD NOT BE COPIED TO IT.
@ECHO ÿ
@ECHO        If this drive exists on your machine, the problem may be due
@ECHO   to an error in typing the TO_Drive in the SINSTALL command.  
@ECHO        You must type a colon (:) after the drive letter, and there
@ECHO   must be no space between the drive letter and the colon.  For
@ECHO   example, type A:, but not A : or not A without the colon.
@ECHO        If you requested installation to a floppy drive, the drive door
@ECHO   may be open, or the diskette may be write-protected or unformatted.
@ECHO        Before running SINSTALL again, use the DIR command to confirm
@ECHO   that the TO_Drive is indeed ready. 
GOTO END
:BAD2DIR
@ECHO ÿ
@ECHO 
@ECHO         DIRECTORY YOU SPECIFIED, %3, COULD NOT BE CREATED
@ECHO               OR FILES COULDN'T BE COPIED TO IT.
@ECHO ÿ
@ECHO    The problem may be due to an error in typing the TO_Directory name in
@ECHO    the SINSTALL command.  You must precede all Directory Names with a
@ECHO    backslash (\), not a slash (/).  There must be no space between the
@ECHO    backslash and Name and no blank spaces in the Name itself.
@ECHO         Some correct examples:  \STATHELP or \UTILS\STATHELP
@ECHO         Some BAD examples: \ STATHELP or \STAT HELP or \UTILS \STATHELP
@ECHO    The Name you specify must, of course, be a legitimate DOS directory
@ECHO    name, with a maximum of 8 characters and no "forbidden" characters.
@ECHO ÿ
GOTO END
:BADFROM
@ECHO ÿ
@ECHO 
@ECHO COULD NOT FIND OR READ THE STATHELP ARCHIVE FILE (SHZIPARC.EXE) ON DRIVE %1
@ECHO ÿ
@ECHO    The problem may be due to an error in typing the FROM_Drive name in
@ECHO    the SINSTALL command: you must type a colon (:) after the drive
@ECHO    letter, and there must be no space between the drive letter and
@ECHO    the colon.  E.G., type A:, but not A : or A without the colon.
@ECHO ÿ  If the drive name was typed properly, the problem may be due to
@ECHO    changing diskettes or openning the drive door after you started
@ECHO    the installation.  Before trying again, use the DIR command to see
@ECHO    if the archive file SHZIPARC.EXE is indeed where you think it is.
GOTO END
:ZIPERROR
@ECHO ÿ
@ECHO 
@ECHO        AN ERROR OCCURRED IN THE UN-ARCHIVING PROCESS
@ECHO         ALL STATHELP FILES WERE NOT COPIED TO DRIVE %2
@ECHO ÿ
@ECHO    Try running SINSTALL again -- a few more times if necessary.
@ECHO    If you continue to get this Error Message, consult the README.1ST
@ECHO    file on the distribution disk for alternative install instructions.
GOTO END
:OOPS
IF EXIST %2\WATSTAT.EXE DEL %2\WATSTAT.EXE
IF EXIST %2\WATSTAT.TXT DEL %2\WATSTAT.TXT
IF EXIST %2\WATSTAT.HLP DEL %2\WATSTAT.HLP
IF EXIST %2\WATSTAT.INX DEL %2\WATSTAT.INX
IF EXIST %2\WATUT.EXE DEL %2\WATUT.EXE
IF EXIST %2\LOOKUP.EXE DEL %2\LOOKUP.EXE
IF EXIST %2\RANDO.EXE DEL %2\RANDO.EXE
IF EXIST %2\SHMANUAL.DOC %2\SHMANUAL.DOC
@ECHO ÿ
@ECHO 
@ECHO	             INSUFFICIENT DISK SPACE ON DRIVE %2
@ECHO ÿ
@ECHO         Drive %2 does not have the space required (about 470K bytes) to
@ECHO	      hold all the STATHELP files.  If any files were copied to Drive %2,
@ECHO	      this install program has attempted to delete them, since they may
@ECHO	      have been corrupted.  However, you should use DOS's DIR command to
@ECHO	      see if any STATHELP files remain on Drive %2.  If so, delete them
@ECHO	      with DOS's ERASE or DEL commands.
@ECHO ÿ
GOTO END
:USAGE
@ECHO ÿ
@ECHO   INSTRUCTIONS FOR RUNNING THE INSTALLATION BATCH FILE: SINSTALL.BAT
@ECHO ÿ
@ECHO  First, go to the Drive you're installing FROM, by entering the appropriate
@ECHO  Drive name, e.g, A:.  Then run SINSTALL by typing a command with the
@ECHO  following form: 
@ECHO ÿ
@ECHO              SINSTALL FROM_Drive TO_Drive TO_Directory
@ECHO ÿ
@ECHO  For example, if you're installing FROM Drive A: and want to install
@ECHO  TO Drive C: and TO a Directory called \STATHELP, you'd type:
@ECHO ÿ
@ECHO                     SINSTALL A: C: \STATHELP
@ECHO ÿ
@ECHO Always use a colon (:) after Drive letters and a backslash (\) preceding
@ECHO Directory names.  If the TO_Directory doesn't exist, SINSTALL will create it.
@ECHO You may specify a Sub-Directory nested under one that already exists, e.g.,
@ECHO \UTILS\STATHELP, where \UTILS already exists.  It's best to install TO a hard
@ECHO disk, but you may install TO a 3.5" or a High Density 5.25" floppy, if it has
@ECHO at least 470K bytes of free space.  If you install TO a floppy, no TO_Directory
@ECHO name is needed: SINSTALL ignores directories for floppies and won't create any
@ECHO you specify.  However, it always installs to a directory on a hard disk and,
@ECHO if you don't supply a name, it will use \STATHELP by default.  If you install
@ECHO FROM a floppy, the FROM and TO drives must be different, e.g., installing FROM
@ECHO Drive A: TO Drive A: isn't allowed.
:END


