                                 BATMENU.PAS

             Copyright 1990, W.B. Malthouse - M-Squared Systems, Inc.

   This program may be copied, distributed, and used by general public,
   without limitation on that use, without specific written permission
   of the author/copyright holder without limit, provided that:

      1. No charge or license fee is made for copies or the use thereof.
      2. This copyright notice is included, unmodified, in all such
         copies distributed per (1) above.
      3. A nominal fee, not to exceed $10.00, may be charged for the
         media on which copies are distributed and to cover postage and
         handling etc.

    This program may be used as the basis for enhanced program development
    in whole or part by prior agreement with the author/copyright holder.

The Pascal program "BATMENU" automates the process of executing BATCH programs
in a special way, using the fact that DOS BATCH files can be rewritten WHILE
they are being executed!

The point of this menuing system is not just that .BAT files can be re-written
on-the-fly by a program, but that invoking programs this way places NO memory
overhead in a system, unlike executing some TSR menu system, or even using
the DOS "EXEC" service call from within a menu program.

BATMENU reads the contents of whatever BATCH file was used to invoke it,
looking for its own name.  When it finds its name, it then proceeds to
rewrite the remainder of the batch file, AFTER it obtains the user's choice
from a short menu, which it uses to REPLACE the (normally REM or previous
choice) line that immediately FOLLOWS the "BATMENU" line.  The process uses
a new, temporary batch file to make the copy, followed by an "erase" on the
original batch file and a rename of the temporary file to the same name as
the original batch file name.

The result of this shenanigans is that the invoking BATCH file will then quite
simply execute its "next" line, the one inserted by BATMENU!

Most of BATMENU is devoted to allowing all sorts of options, including the
viewing of any file in a "-More-" style via the HELP facility.  The real
"guts" of the program simply handles the altering of the invoking BATCH file
to reflect the user's choice.

Please feel free to take the program text as a starting point and make your
own extended "BATCHMAN" program.  For example, this version of the program
supports only a single "main" menu, which is hard-coded in the text.  One
simple modification would be to support menu's coded by the user as ".mnu"
files, where the program simply displayed the contents of the ".mnu" file
and inserted the corresponding commands into the invoking batch file.

The distribution package includes BATMENU (Source and .EXE), the files
Menu.Bat (driver) and Menu.Hlp (this file).  It also includes copies of
the utility programs invoked directly from BATMENU in its present form.
In addition, I have included the "STRS.TPU" Turbo Pascal 5.5 "Unit" which
is used by BATMENU for string operations such as CAPS and TRIM, along with
a STRS.HLP file which shows the interface to this program.

Note that the PASCAL "STRS.TPU" has a number of service entry points for
strings which you may use for any Pascal program.  I have provided only
the ".TPU" file here, together with a "STRS.HLP" file which shows the
interface to the unit.  Please contact me if you need the source for the
unit itself, and we will discuss your ideas for extensions etc.

                                       Bill Malthouse
                                       5201 George McKay Ct.
                                       Fairfax, VA 22030
                                       (703)-830-4189

