
        
             SPAWN - An alternative to Command.com        
        
    1.0  Overview
        
        Spawn is a  command  processor  that  takes  over  many  of  the 
        functions of command.com (to the uninitiate, this is the program 
        that  reads  commands  from  the  keyboard in PC-DOS), providing 
        different or additional functionality.  Anything  that  it  does 
        not provide it simply passes unchanged down to command.com.  The 
        major features of spawn are:
        
        * Command line recall and edit for the last 32 commands.
        * File name completion using Ctrl-D and Ctrl-F.
        * Ability to define symbols abbreviating command strings
        * Ability to define logical names to replace path names
        * Directories sorted in alpha order, showing the file attributes
        * Ability to define command strings as function keys
        * Enhanced delete command, with multiple file specs
        * Xdel command, to delete all files except specified
        * Selectable colors using the color command
        * Function to remember the last file being edited
        * Function to save and restore a default drive and directory
        * Current date and time accessible with Ctrl-T
        * Multiple spawn support under OS/2

        Spawn is an ordinary application program.  Once started it never 
        terminates until requested to do so.  It simply reads keystrokes 
        from  the  keyboard,  and  checks to  see if they translate to a 
        command for spawn.  If they  do,  it  executes  the  appropriate 
        function.   If not, it invokes a copy of command.com, passing it 
        the enigmatic command line.  
        
        
    1.1  Startup
        
        Spawn is started by simply running  the  program  spawn.exe  (In 
        OS/2  protected  mode,  run spawnp.exe).  When it loads, it will 
        first check its own  command  line for a  parameter of  the form   
        "/maxdir:n", where n is a number.  This is the number of entries 
        it  will  allocate  to  its  directory  buffer.    This   number 
        represents  the maximum number of files that can be processed on 
        a call to dir, fdir, del or xdel.   If  this  parameter  is  not 
        present,  n  defaults to 512.  Since each entry in the directory 
        buffer  requires  25  bytes,   changing   this   parameter   can 
        significantly  affect  the amount of memory used by spawn.  Next 
        it attempts to open  the  file  SPINIT.SPN,  checking  both  the 
        current  directory, and the directory defined in the environment 
        variable SPFILS.  If found, it will read input  from  that  file 
        until  end  of  file, then reconnect to the keyboard.  Generally 
        this file will contain the define and alias commands required to 
        set up the symbols and logical names for the session. 

        Example:
        set SPFILS=c:\spawn\  (note the trailing backslash)
        spawn

        (spinit.spn can be on current directory or on  c:\spawn.)  Spawn 
        will  perform  better  if command.com is loaded into a ram disk, 
        since it makes repeated calls to command.com.

        
    1.2  Keyboard interface
        
        Before examining the commands spawn uses, the keyboard interface 
        is worthy of note.  One of the major incentives in writing spawn 
        was to beef up the keyboard handling of command.com.
        
        Spawn uses a  fairly  simple  model;  characters  typed  at  the 
        keyboard  appear  on  the  screen,  as in command.com.  However, 
        where command.com uses F1-F5 to edit the command line, spawn  is 
        much simpler.  The left and right arrow keys move back and forth 
        within  the  command line.  The delete key deletes the character 
        under the cursor, backspace deletes to the left.  The insert key 
        toggles between insert  and  typeover  modes  (typeover  is  the 
        default;  the  cursor  changes  to a block when in insert mode).  
        Ctrl-left and Ctrl-Right will move left and right a  word  at  a 
        time.   Home  goes to the beginning of the line, End to the end. 
        Ctrl-Home will delete all characters to the left of the  cursor, 
        Ctrl-End  will delete all characters to the right of the cursor.  
        The Escape key will delete the current line.  So far nothing  is 
        really  unusual,  though the ability to move without deleting is 
        handy.  Also worth noting is the fact that the cursor  does  not 
        need to be at the end of the command line to press <Enter>.  All 
        characters  in  the command line are processed regardless of the 
        current cursor position.
        
        The up arrow and down arrow trigger command  line  recall.   The 
        last  32  commands  are  held in a queue.  Pressing the up arrow 
        will bring the previous command in the queue, pressing the  down 
        arrow  will  bring  up the next.  The queue wraps around, so you 
        may cycle through it continuously.  When a line from  the  queue 
        is  brought  to  the  screen,  it  may  be editted with the keys 
        described above.  If the line is changed, it is added to the end 
        of the queue.  If it is unchanged, it is simply reused,  without 
        being  added to the queue.  This can be sometimes confusing, but 
        has the benefit that command lines tend to  stay  in  the  queue 
        longer,  and  may be reused many times without causing the queue 
        to fill  with  duplicates.   The  queue  may  be  flushed  using 
        Ctrl-PgUp.  This is handy for removing incriminating evidence of 
        games playing.
        
        In addition to the command line recall, several other  keys  are 
        available   to  make  command  line  entry  easier.   For  users 
        accustomed to VMS, Ctrl-R will start a new  line  and  redisplay 
        the command line.  This is rarely used but sometimes useful.  In 
        the  same  vein,  Ctrl-X  and Ctrl-U function the same as <Esc>, 
        cancelling the current command.
        
        Ctrl-T will print the current date and time, without affecting 
        the command line.
        
        Ctrl-D  and  Ctrl-F attempt filename completion, much as is done 
        in the Unix raw shell.  When Ctrl-D is pressed, the  word  under 
        the  cursor  is treated as a path/file name.  Next the directory 
        is searched for any files  starting  with  the  fragment.   (For 
        example,   if  c:\tools\sc^D  is  entered,  spawn  searches  for 
        c:\tools\sc*.*).  If only one file matches, the remainder of the 
        file name is filled in for you, and the cursor advanced  to  the 
        end of the completed name.  If multiple files match, the name is 
        completed  as  far  as  possible  until  the  the  possibilities 
        diverge.  (In the above example, if the  files  scanner.dat  and 
        scanrun.dat  were  present,  the  name  would be completed until 
        c:\tools\scan).  All of the possibilities are displayed  on  the 
        screen,  so  you may choose from the alternatives.  You may then 
        enter another character or two and press Ctrl-D to fill  in  the 
        rest,  or  type  the  rest  in  manually.   Though  this  sounds 
        confusing, it is really quite simple.  Ctrl-F  is  the  same  as 
        Ctrl-D,   but   merely   lists  all  the  possibilities  without 
        attempting to complete the name on the command  line.   This  is 
        useful  if  you are not sure which file you want and need to jog 
        your memory.  Together Ctrl-D and Ctrl-F  can  greatly  simplify 
        the  entry of pathnames from the keyboard.  Both also understand 
        logical names, and will translate  them  as  required  (see  the 
        section on logical names).
        
        
    1.3  Operations
        
        Spawn acts just like command.com, in that you type  commands  at 
        the prompt and they get executed.  You do not generally care how 
        the are executed, so long as they get done.  
        
        Command.com   divides   commands  into  two  different  classes: 
        internal and external.  Internal commands are  those  for  which 
        the code resides directly in command.com and is called directly.  
        External  commands  are  those  which  are  contained in another 
        program and which must be loaded from disk.
        
        Spawn is the same way; it has  a  number  of  internal  commands 
        which  are  performed by spawn itself.  Anything that it can not 
        recognize as an internal  command  it  simply  passes  along  to 
        command.com,  which  in  turn  decides  if  it  is  internal  or 
        external.  This is required because spawn does not replicate all 
        of the internal functions of command.com.
        
        Having said all this, it should be  obvious  (or  at  least  not 
        surprising),  that the only things that are different when using 
        spawn are spawn's own internal commands.   The exception to this 
        is the spawn keyboard interface as described above.
        

    2.0  Commands        
        
        Spawn has a large number of internal commands.  Some provide  no 
        additional  functionality  over  command.com,  but  are included 
        simply because they are done so many times.

                
        DEF*INE  SYMBOL  TRANSLATION
        ----------------------------
        
        The define command creates symbols.  A symbol consists of a  tag 
        and its translation.  Generally a symbol is used to abbreviate a 
        long  command  line  or  portion thereof, or to tie a particular 
        command to a function key.
        
        For example, consider the command
        
        define bkp backup c:\sct21\*.* a: /s/m:12-25-88
        
        The keyword define says that we  are  creating  a  symbol.   The 
        symbol  is  bkp,  and its translation is "backup c:\sct21\*.* a: 
        /s/m:12-25-88".   Once  defined,  if  you  type  "bkp"  at   the 
        keyboard,  the  command  "backup  c:\sct21\*.* a: /s/m:12-25-88" 
        will be executed.  This is the simplest form of  a  symbol,  and 
        serves only to reduce the number of keystrokes you must type.

        Consider   the   problem   of  navigating  between  directories.  
        Directories are tree structured, and it is not uncommon for  you 
        to  think  of  something as being a level higher or lower in the 
        tree, or on the same level but a different branch.  DOS provides 
        the capabilities for  navigating  the  tree,  which  are  seldom 
        exploited.   Few realize that the command "cd .." will change to 
        the parent directory (same branch, one level  up)  or  that  "cd 
        ..\sibling" will go up and over.  The command "cd child" will go 
        one  level  down  in  the  tree.  These commands are seldom used 
        partly because of the awkardness of typing "..\".  Consider  the 
        following symbols:
        
        define side cd ..\
        define up cd ..
        define down cd 
        
        Typing  "side  sibling"  translates  to  "cd  ..\sibling" (it is 
        important that there be no trailing spaces after  the  ..\  when 
        the  define  is done, since we wish the sibling to bind directly 
        to  the  ..\,  and  not  as  "..\  sibling").   Similarly   "up" 
        translates  to "cd ..". These shorthands are very convenient for 
        traversing large directory trees.
        
        The astute reader may have noticed  that  the  heading  of  this 
        section  said  "DEF*INE".   The  asterisk  is part of the symbol 
        definition.   Its  presence  indicates  the  minimum  acceptable 
        abbreviation for the symbol.  "def*ine" says that "def", "defi", 
        "defin",  and  "define"  are  all  valid,  but  "de", "defo" and 
        "defile" are not.  An asterisk can be placed in  any  symbol  to 
        define the minimal abbreviation.

        Function  keys  can  be defined as symbols.  Any symbol with the 
        form "define funct_keyN", where N is the number  of  a  function 
        key,  defines  that function key as a symbol. Function keys will 
        take precedence over whatever command line  is  displayed;  that 
        is,  if  a function key is pressed while a command line is being 
        built, only the function key press is processed.  Function  keys 
        are  always  acted  on  immediately,  so they can not be used to 
        enter partial commands.  You can think of  pressing  a  function 
        key  as the equivalent of <Esc>, function key, <Enter>.  Only F1 
        - F10 may be defined, using the syntax  funct_key1,  funct_key2, 
        etc.
        
        Once  created,  symbols  can  not be deleted, though they can be 
        changed  by  defining  the  same   symbol   with   a   different 
        translation.  The definition of all symbols can be list by using 
        the "show sym" command.  


        ALIAS LOG_NAME PHYS_NAME
        ------------------------
        
        The  alias  command  defines  a logical name.  Logical names are 
        similar to symbols but different in scope and grouping.   To  be 
        translated, a symbol must always be the first token (basically a 
        word)  on the command line.  Symbol translation is single level, 
        and is assisted with the abbreviation logic.
        
        Logical names are intended to serve as  shorthand  for  file  or 
        path  names,  but  can  be  treated  similarly to symbols.  When 
        encountered anywhere on the command line, the  logical  name  is 
        translated to its physical name.
        
        For example, consider the following:
        
        alias bootdir c:\system\boot
        dir bootdir
        
        The  alias  command defines the logical name bootdir to mean the 
        directory c:\system\boot.  The dir command will list all of  the 
        files  in  the  directory  c:\system\boot.   So far this is very 
        similar to symbol translation.  However, a logical name  can  be 
        combined with a physical name using a colon (:).
        
        alias bootdir c:\system\boot
        dir bootdir:vdisk.sys
        
        The   dir   command   in   this   instance   translates  to  dir 
        c:\system\boot\vdisk.sys.  When a logical  name  is  translated, 
        the translation routine decides whether the colon should be left 
        in  place,  omitted, or translated to a '\'.  It always attempts 
        to turn the physical name into a file name if possible.
        
        Logical name translation is recursive; consider
        
        alias bootdir c:\system\boot
        alias ramdriver bootdir:vdisk.sys
        
        To  resolve  ramdriver,  the  logical  name  bootdir   must   be 
        translated,    so    the   definition   of   ramdriver   becomes 
        "c:\system\boot\vdisk.sys".        
        
        More than one logical name can appear on a line.  Consider
        
        alias rev20  c:\sct20\source
        alias rev21  d:\sct21\source
        copy rev20:*.c rev21:*.old
        
        In this instance both logicals are translated, so the  resulting 
        command is "copy c:sct20\source\*.c d:\sct21\source\*.old".
        
        Once assigned, logical names remain in  effect  until  destroyed 
        with  the DEASS command.  Logical names are translated by Ctrl-D 
        and Ctrl-F, but are not completed by them.   The  definition  of 
        all  current  logical  names  can  be listed with the "show log" 
        command.

        
        DEASS*IGN LOG_NAME
        ------------------
        
        This  command  is  the  opposite  of alias.  It removes from the 
        logical name table the logical name specified.
        
                
        VE*DIT  EDITOR_PARAMS
        ---------------------

        The ved command is designed to work with a text  editor  (in  my 
        case,  not suprisingly, vedit), but can really be applied to any 
        program.  What it does, is examine the command  line  associated 
        with  the  command;   if  it is not null, it saves it.  If it is 
        null, it appends the last value  of  the  command  line  to  the 
        translation  of  the  symbol  and  executes  that.   Though  the 
        description is rather long winded,  the  explanation  is  simple 
        enough;  if  you  do  not supply a filename to a text editor, it 
        will start up with the last one you worked on.  When a file name 
        is saved, it is expanded into  a  complete  filespec,  including 
        drive  and directory.  In this way, the default directory may be 
        changed, but the editor will still  edit  the  same  file.   The 
        actual program executed by the vedit command is the value of the
        environment variable VEDEXE.  For example:
        
        set VEDEXE=c:\jfe\vedit.com
        spawn
        vedit config.sys
        Editing file: c:\config.sys
        (do your editing here...)
        vedit
        Editing file: c:\config.sys
        (do your editing here...)
        
        The  vedit  command  has  some smarts; if there is more than one 
        token on the command line it will not attempt to expand out file 
        specs, and if the file spec contains a \ or : it assumes  it  is 
        already a pathname and will not try to expand it.
        
        Under OS/2 more applications are smart enough to remember what 
        they were doing before exiting, and this command is not needed
        nearly as often.  What I have done in OS/2 is to reassign this
        command so that it invokes make with the last makefile used.
        The proper commands are (these should go in spinit.spn):
        
        define ve*dit mep   ; this switches the normal vedit to mep
        define make $$i     ; define make to internal command i
        define funct_key5 ved   ; keep f5 as editor invocation
        define funct_key6 $$i   ; but make f6 remember the command line
        
        Then in you config.sys for OS/2, place the following:
        SET VEDEXE=<your make path>make.exe

        
        DIR*ECTORY and FDIR*ECTORY
        --------------------------

        One of the more obnoxious commands in PC-DOS is the dir command.  
        Its  chief  offenses  are that it does not sort the files before 
        displaying them, it does not give the total size  of  the  files 
        listed,  it does not display the attributes of the files, and it 
        will only accept a single specification at a  time.   The  spawn 
        dir  command  fixes  all  of these problems.  Syntactically, the 
        format of the command is:
        
        [f]dir[ectory] [file_spec [file_spec [file_spec... ]]] [/p][/w]
        
        That  is,  the  word  dir  or  fdir,  followed  by  zero or more 
        path/file specifcations.  The actual rules for interpreting  the 
        file   specifications   are   surprisingly  complex,  but  quite 
        intuitive if you are used to the DOS version of the command.
        
        If the /p qualifier is present,  the  display  will  stop  every 
        screenful   and  prompt  for  a  key  before  continuing.   This 
        qualifier may appear anywhere on the command line.  In DOS spawn 
        always assumes that a screen is 25 lines.  In OS/2 it is smarter 
        and will use the proper number of lines when /p  is  used.   (If 
        you  are  running in a window, the number of screen lines is the 
        number of lines the window would have when  maximized,  not  the 
        number  of  lines displayable at the current size of the window.  
        The scroll bars on the window can move around  within  the  full 
        screen size).

        The /w qualifier displays only  the file names, and  displays as
        many as possible on each line.  Directories are preceded with an
        asterisk (*).

        The  output from spawn is sorted alphabetically by name (to make 
        directory management easier, subdirectories always appear at the 
        beginning of the display), with the file attributes shown at the 
        beginning of the line.  The three possible  attributes  are  'r' 
        for read only, 'h' for a hidden file, and 's' for a system file.  
        Absence  of  an  attribute is indicated by a dash (-), so normal 
        files will be preceded by a "---" on the directory listing.  The 
        dir command will not display hidden or system files,  while  the 
        fdir command will.  Otherwise the two commands are identical.
        
        Entry of multiple file specifications to the dir command 
        complicates matters.  For example, the command:
        
        dir *.c *.lst
        
        will show all of the .c and .lst files on the current directory, 
        sorted by alphabetical order.  So far, so good.  The command:
        
        dir c:\*.sys c:\system\boot\*.sys
        
        will show all of the .sys files in both directories --  however, 
        because  multiple  directories  are involved, the directory name 
        will be shown preceding each file, and the sorting will sort  by 
        the  full  pathname, grouping all of the files in each directory 
        together.  In contrast, the command:
        
        dir sl:*.c sl:*.obj   (where sl is a logical name)
        
        will translate the the logical name sl, then give a directory of 
        all the .c and .obj files on the directory that sl evaluates to. 
        In  this  case,  since  all  of  the  files  reside  on the same 
        directory, only the file names are displayed. Finally a  command 
        like:
        
        dir *.c .\*.c *.c
        
        will  produce  a  list  of  all  the  .c  files  on  the current 
        directory, and a list of the same files preceded by ".\".   This 
        is   because  so  far  as  spawn  is  concerned,  two  different 
        directories are  involved:  the  current  (no  string)  and  the 
        directory   ".\"  (which  evaluates  out  to  mean  the  current 
        directory).  The duplicate *.c specs do not  bother  it  --  the 
        duplicates created there will be flushed and only displayed once 
        --  but  it  will be fooled by the ".\".  The moral of the story 
        here is that if you don't try to fool spawn it won't try to fool 
        you.
        
        
        DEL*ETE and XDEL*ETE
        --------------------
        
        Spawn replaces the del command from PC-DOS with its own  version 
        (by  default ERASE is not defined, and will invoke the DOS erase 
        command), which has much of the same enhancements that  the  dir 
        command  does.   It  accepts multiple specifications on the same 
        command, and has a /v option that prints out the  name  of  each 
        file as it is deleted.  Syntactically, the command is:
        
        [x]del[ete] file_spec [ file_spec... ] [/v]
        
        Up  to  ten different file specifications can be included on the 
        command line.  Unlike DOS, the spawn  delete  command  does  not 
        prompt  with "Are you sure?" if the file specification evaluates 
        out to *.*.  If you ask for *.*, you get *.* with no backtalk.
        
        The xdel command is similar to del, but deletes all of the files 
        except those listed.  For instance,
        
        xdel *.c makefile.*
        
        will delete all the files on the current directory except  those 
        with  a .c extension or a name portion of makefile.  Overlapping 
        specifications (in this instance a  file  makefile.c)  cause  no 
        problems.
        
        Xdel attempts to establish a target directory for its deletions. 
        It   need   not   be   the   current  directory,  but  all  file 
        specifications must evaluate out to  the  same  directory.   For 
        instance, the command
        
        xdel c:\*.sys c:\system\boot\*.sys
        
        will  give  an  error message to the effect that only one target 
        directory can be referenced, while the command
        
        xdel c:\system\boot\*.sys c:\system\boot\*.drv
        
        would  work   without   complaint,   deleting   all   files   on 
        c:\system\boot that do not end .sys or .drv.
        
        Xdel  also  supports the /v option (which may be anywhere on the 
        command line), to print out the name of each file that is  being 
        deleted  or  preserved.   Xdel is vulnerable to confusion in the 
        same way  that  the  dir  command  is,  by  pathnames  that  are 
        different  but actually refer to the same path; in this instance 
        it will give the error about multiple target directories.
        
        
        SDIR and RDIR
        -------------

        The  sdir  command  simply  saves the  current default drive and 
        directory for later use.  It produces no output.   This  command 
        is automatically executed when spawn is started.
        
        The rdir command will set the default drive and directory to the 
        values saved by sdir.  Again, no output is produced.
        
        You may find it handy to tie these commands to function keys, so 
        that they can be quickly invoked:
        
        def funct_key7 sdir
        def funct_key8 rdir

        
        COLOR
        -----
        
        The color command sets the color that spawn  will  use  for  its 
        output  and  the  output of programs that it calls, unless those 
        programs override it with their own color setting (as most  do). 
        The syntax is:
        
        color [bright] foreground_color on background_color
        
        where  foreground_color  and  background_color  must  be one of: 
        black, blue, green, cyan, red, magenta, yellow  or  white.   The 
        bright parameter is optional and will cause the foreground color 
        to  be high intensity.  Good choices for color are white on blue 
        and green on black, but by all means experiment.
        
        Color  setting  is  done  primarily  through  ansi.sys,  so  the 
        ansi.sys  device  driver  must  be  installed in your config.sys 
        file.  Failure to install ansi.sys will not  cause  catastrophic 
        errors, but output will look somewhat odd.
        
        The default color setting is green on black.

                        
        PTOG
        ----
        
        The ptog command stands for "prompt toggle".  Unlike PC-DOS (and 
        one  of  the  few  areas  where  spawn  is  not  as versatile as 
        command.com), the prompt in spawn is not defineable.  By default 
        the prompt is the volume name of the  default  drive  (or  drive 
        letter  if  the  default  drive  is unlabelled), followed by the 
        default  directory  and  a  greater  than  sign.   If  this   is 
        undesirable,  or  too  long,  the ptog command will minimize the 
        prompt.  Typing ptog again will change it back.

        In  real  mode  (DOS  or  OS/2 compatibility mode) the prompt is 
        preceded by an (R) to indicate real  mode.   In  OS/2  protected 
        mode  the  prompt  is proceeded by the session nickname, such as 
        (Bert).  When minimized, the real mode prompt  is  R$,  and  the 
        OS/2 prompt is n$, where n is the ordinal number of the session. 
        (Ordinal numbers are generally assigned in the order of startup, 
        until  one  session  terminates,  in which case the next startup 
        will reuse its ordinal number.  See the section on OS/2 for more 
        on this stuff).


        HIST
        ----

        This  command  simply lists the commands in the keyboard history 
        queue.  The last 32 commands are saved,  not  counting  function 
        key presses or commands that were reused from the queue.

        
        SHOW { MEM*ORY LOG*ICAL SYM*BOLS VED*IT VER*SION }
        --------------------------------------------------
        
        The show command requires one  of  the  arguments  shown  above.  
        Each produces different output.
        
        SHOW MEM will display the amount  of  memory  installed  (up  to 
        640KB),  the  amount  used  by  the system (DOS, device drivers, 
        TSR's, etc.), the amount used by spawn, and the amount available 
        for programs called by spawn.  This last value will generally be 
        about 4K more than  the  value  shown  by  the  chkdsk  command, 
        because  of the overhead incurred by calling command.com to call 
        chkdsk.
        
        In  OS/2  protected  mode the  show mem command is not nearly as 
        interesting.  It shows the approximate size of the spawn program 
        itself (not counting environment and  shared  memory),  and  the 
        size  of  the  largest remaining free block.  This is the amount 
        that is available for other applications to use.  This  may  not 
        represent  the  true  amount  of memory remaining in the system, 
        since OS/2 may well be able to coalesce free blocks if a request 
        is made for a block exceeding the remaining size.   The  virtual 
        memory  aspects of OS/2 and the MEMMAN command in the config.sys 
        file give it considerable flexibility to find memory.
        
        SHO  LOG  will display the logical and physical names of all the 
        defined logicals.
        
        SHO SYM will display the symbol and translation for all  of  the 
        symbols defined.
        
        SHO  VED  will display the program tied to the vedit command and 
        the currently saved command line for that program.

        SHO VER will display the version level of spawn.

        
        KILL
        ----
        
        This command exits  spawn,  returning  you  to  command.com  (or 
        whatever program invoked spawn).


        CLS and CD and SET
        ------------------
        
        These  commands  do nothing that command.com doesn't do, but are 
        implemented in spawn so that a copy of command.com doesn't  have 
        to be loaded just to do these trivial functions.
        
        Additionally,  SET is internal because copies of the environment 
        are always passed by value, so it is not generally possible  for 
        one  program to modify anothers environment.  Spawn will inherit 
        the DOS environment, but after that maintains its own.

        Changing  drives  is  also  done  internally  (a command such as 
        "d:"), because in OS/2 the notion of default drive and directory 
        are local to a process and no other process can  change  spawn's 
        default drive and dir. 


        @ COMMAND QUALIFIER
        -------------------        
        
        Technically  speaking,  @  is  a  command  qualifier  and  not a 
        command, but it helps to think of it as  a  command  in  and  of 
        itself.  The presence of an @ sign preceding a command indicates 
        that the next token on the command line is a filename containing 
        commands  for  spawn to execute (analogous to a DOS batch file). 
        The file is presumed to have an extension of  .SPN,  and  to  be 
        either  on  the current directory or in the directory referenced 
        by the SPFILS environment variable. Any spawn or DOS command can 
        be executed inside of a spawn file, though the DOS commands that 
        work only within batch files are not available.  Spawn will  not 
        echo  the contents of .spn files.  When all commands in the file 
        have been read, input is reattached to the keyboard.

        
        & COMMAND QUALIFIER
        -------------------

        The & is also a command qualifier.  It tells spawn that  instead 
        of  invoking  command.com to execute the command line, the first 
        token should be treated as a program name and executed directly, 
        without going through command.com.  This is slightly faster, and 
        saves about 4KB of  memory,  but  will  not  work  for  commands 
        internal to command.com, and commands which are not well behaved 
        about reading their command line.

        This  command  will  search  the current PATH for the file to be 
        executed.

        This  qualifier  is  also  available  in  OS/2,  but  to   avoid 
        conflicting  with the normal usage of the & in OS/2, it has been 
        changed to the right bracket character "]".
        
                
        OS/2 PROTECTED MODE
        -------------------
        
        The program spawnp.exe is an  OS/2  protected  mode  version  of 
        spawn.   In  general the two behave identically, with the slight 
        differences noted in the descriptions above.  However, the  OS/2 
        version  has a different prompt scheme (as described in the PTOG 
        command), and has two commands that are  not  available  in  DOS 
        mode.

        
        HIGHT nickname  (OS/2 only)
        ---------------------------
            
        This command changes the session nickname. The session  nickname 
        is  the word displayed in parentheses before the volume label as 
        part of the prompt.  If the nickname is blank the  current  name 
        is printed.  Nicknames can consist of any ASCII characters up to 
        a length of 31.

        This command is not available in DOS (real) mode.
            
            
        SYNC {/query | /notify | /nonotify} [nickname] (OS/2 only)
        ----------------------------------------------------------
            
        The sync command is used to (what else)  synchronize  processing 
        between  multiple OS/2 sessions.  It's intended usage is to give 
        you  a  quick  method  of  checking  on  another  process.   For 
        instance,  suppose  you  are  using  3  screen  groups:  an edit 
        process, a compile process, and a test environment.  You edit  a 
        file,  flip  over to the compiler process to compile, go back to 
        the editor and edit some more, then want to know if the  compile 
        has  finished  so  you can test.  You Alt-Tab through all screen 
        groups until you find the right  process,  discover  it  is  not 
        done, then Alt-Tab back.  All in all, a laborious process.
            
        With spawn, you use:
            
        sync /query Bert
         
        spawn responds with
            
        Bert is busy doing "make"
            
        or 
            
        Bert is idle.
            
        Bert  in  this instance is a session nickname.  Sync /query is a 
        single check on the status of a session, or, if no  nickname  is 
        given, all sessions.
            
        sync  /notify  is  slightly  more  sophisticated.   If notify is 
        turned on (it is enabled for all sessions by default),  whenever 
        another session completes a command while in the background, the 
        foreground session will display a message of the form
            
        session has finished "command"
            
        where "session" is the session nickname  and  "command"  is  the 
        command that was just executed.  /notify is only operative while 
        spawn  is  in  the  foreground  and  is  taking  input  from the 
        keyboard.  sync /nonotify disables  notify  mode  for  either  a 
        single session or for all sessions if no name is given.
            
        This command is not available in DOS (real) mode.
        

        
        QUICK REFERENCE
        ---------------
        
        Getting started: 
        
        Spawn uses two environment variables:
        
            VEDEXE should be set to the full pathname of the program to be 
                   used with the vedit command.
        
            SPFILS should be set to the directory where .spn (spawn batch 
                   files) can be found.  This specification must include 
                   a trailing backslash (i.e. c:\spawn\)
                
        The file spinit.spn (in the SPFILS directory) is executed upon 
        startup.
        
        In DOS, start spawn with:
        
            spawn /maxdir:n  (a good value for n is 250)
        
        in OS/2, start spawn with
        
            spawnp /maxdir:n  (again, n=250 is about right).
        
        
        KEYBOARD ENHANCERS:
            Ctrl-D    Complete filename
            Ctrl-F    List matching filenames
            Ctrl-T    Display date and time
            Ctrl-R    Repaint current command line
            Esc       Delete current command line
            Ins       Toggle between Insert and typeover modes
            Up arr    Restore previous command line from queue
            Dn arr    Restore next command line from queue
            Lft arr   Move cursor left
            Rgt arr   Move cursor right
            Home      Move cursor to beginning of line
            End       Move curosr to end of line
            Ctrl-Rft  Delete all characters to left of cursor
            Ctrl-Rgt  Delete all characters to right of cursor
            Ctrl-PgUp Delete queue of previous commands
        


        COMMANDS:
        
            DEF*INE  SYMBOL  TRANSLATION
                Define a symbol
                
            ALIAS LOG_NAME PHYS_NAME
                Define a logical name

            DEASS*IGN LOG_NAME
                Destroy a logical name
        
            VE*DIT  [EDITOR_PARAMS]
                Invoke a text editor, restoring last command line if 
                none given
        
            [F]DIR[ECTORY] [FILE_SPEC [FILE_SPEC...]] [/P][/W]
                Display a directory for normal files (dir) or all  files 
                (fdir).  Pause every screenful if /p is given. Display 
                in wide format if /w is given.
        
            [X]DEL[ETE] FILE_SPEC [ FILE_SPEC... ] [ /V ]
                Delete  files  (del)  or  delete all but specified files 
                (xdel).  Be verbose if /v is given.

            SDIR 
                Save current drive and directory.
                        
            RDIR
                Set default drive and directory to those saved by SDIR.
                
            COLOR [BRIGHT] FOREGROUND_COLOR ON BACKGROUND_COLOR
                Set colors to use for display.
        
            PTOG
                Toggle prompt between default and minimized.
                
            HIST
                Show contents of history buffer.
        
            SHOW { MEM*ORY LOG*ICAL SYM*BOLS VED*IT VER*SION }
                Show things.
        
            KILL
                Terminate spawn
        
            @ COMMAND QUALIFIER
                Invoke a spawn batch file.
        
            & COMMAND QUALIFIER
                Call a program directly (no command.com or cmd.exe)
        
            HIGHT nickname  (OS/2 only)
                Set the session nickname.
        
            SYNC {/query | /notify | /nonotify} [nickname] (OS/2 only)
                Query the status of another spawn session, or enable and 
                disable sync notifications.
                
        
        TECHNICAL NOTES
        ---------------
        
        Spawn is written entirely in  MicroSoft  C,  version  5.1.   Its 
        roots  go  back  to 1984, when version 1 was written in Aztec C.  
        Spawn has grown over the years, and now bears little resemblence 
        to the original.  Portions of the original code still survive as 
        a testament to how ugly the code that is written by a  beginning 
        C programmer can be.
        
        As of version 2.0,  spawn  is  spread  across  4  source  files.  
        spawn.c  contains  the  bulk  of  the  code,  and  is  primarily 
        concerned  with actually  implementing  the  commands.   Input.c 
        contains  the  keyboard  routines and various support functions.  
        Both of these source files are compatible  with  both  OS/2  and 
        DOS.   The other two source files are sysdep-p.c and sysdep-r.c, 
        and are the system dependent functions for  protected  and  real 
        mode.    These  files  have  the  same  entry  points,  but  the 
        implementation of the functions is different.  The  DOS  version 
        links with sysdep-r and the OS/2 version links with sysdep-p.
        
        I  have  never  claimed  that  spawn  is the best product in its 
        class, or that its quality is all it could be.  Much of the code 
        could be smaller and cleaner, and the  source  documentation  in 
        particular  ranges from nonexistent to out of date.  All of that 
        said, it works and I  know  what  does  what,  so  it  meets  my 
        purposes.   If  there is a function you would like to see added, 
        you can take a crack at it yourself, or let me know  and  I  may 
        try  it.  As of the moment I have no major features planned -- I 
        am most likely to spend the effort to try and get the amount  of 
        memory consumed in real mode down.
        
        Happy computing.
        
        
        
