home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / SPAWN203.ZIP / SPAWN.DOC < prev    next >
Text File  |  1990-04-25  |  43KB  |  863 lines

  1.  
  2.         
  3.              SPAWN - An alternative to Command.com        
  4.         
  5.     1.0  Overview
  6.         
  7.         Spawn is a  command  processor  that  takes  over  many  of  the 
  8.         functions of command.com (to the uninitiate, this is the program 
  9.         that  reads  commands  from  the  keyboard in PC-DOS), providing 
  10.         different or additional functionality.  Anything  that  it  does 
  11.         not provide it simply passes unchanged down to command.com.  The 
  12.         major features of spawn are:
  13.         
  14.         * Command line recall and edit for the last 32 commands.
  15.         * File name completion using Ctrl-D and Ctrl-F.
  16.         * Ability to define symbols abbreviating command strings
  17.         * Ability to define logical names to replace path names
  18.         * Directories sorted in alpha order, showing the file attributes
  19.         * Ability to define command strings as function keys
  20.         * Enhanced delete command, with multiple file specs
  21.         * Xdel command, to delete all files except specified
  22.         * Selectable colors using the color command
  23.         * Function to remember the last file being edited
  24.         * Function to save and restore a default drive and directory
  25.         * Current date and time accessible with Ctrl-T
  26.         * Multiple spawn support under OS/2
  27.  
  28.         Spawn is an ordinary application program.  Once started it never 
  29.         terminates until requested to do so.  It simply reads keystrokes 
  30.         from  the  keyboard,  and  checks to  see if they translate to a 
  31.         command for spawn.  If they  do,  it  executes  the  appropriate 
  32.         function.   If not, it invokes a copy of command.com, passing it 
  33.         the enigmatic command line.  
  34.         
  35.         
  36.     1.1  Startup
  37.         
  38.         Spawn is started by simply running  the  program  spawn.exe  (In 
  39.         OS/2  protected  mode,  run spawnp.exe).  When it loads, it will 
  40.         first check its own  command  line for a  parameter of  the form   
  41.         "/maxdir:n", where n is a number.  This is the number of entries 
  42.         it  will  allocate  to  its  directory  buffer.    This   number 
  43.         represents  the maximum number of files that can be processed on 
  44.         a call to dir, fdir, del or xdel.   If  this  parameter  is  not 
  45.         present,  n  defaults to 512.  Since each entry in the directory 
  46.         buffer  requires  25  bytes,   changing   this   parameter   can 
  47.         significantly  affect  the amount of memory used by spawn.  Next 
  48.         it attempts to open  the  file  SPINIT.SPN,  checking  both  the 
  49.         current  directory, and the directory defined in the environment 
  50.         variable SPFILS.  If found, it will read input  from  that  file 
  51.         until  end  of  file, then reconnect to the keyboard.  Generally 
  52.         this file will contain the define and alias commands required to 
  53.         set up the symbols and logical names for the session. 
  54.  
  55.         Example:
  56.         set SPFILS=c:\spawn\  (note the trailing backslash)
  57.         spawn
  58.  
  59.         (spinit.spn can be on current directory or on  c:\spawn.)  Spawn 
  60.         will  perform  better  if command.com is loaded into a ram disk, 
  61.         since it makes repeated calls to command.com.
  62.  
  63.         
  64.     1.2  Keyboard interface
  65.         
  66.         Before examining the commands spawn uses, the keyboard interface 
  67.         is worthy of note.  One of the major incentives in writing spawn 
  68.         was to beef up the keyboard handling of command.com.
  69.         
  70.         Spawn uses a  fairly  simple  model;  characters  typed  at  the 
  71.         keyboard  appear  on  the  screen,  as in command.com.  However, 
  72.         where command.com uses F1-F5 to edit the command line, spawn  is 
  73.         much simpler.  The left and right arrow keys move back and forth 
  74.         within  the  command line.  The delete key deletes the character 
  75.         under the cursor, backspace deletes to the left.  The insert key 
  76.         toggles between insert  and  typeover  modes  (typeover  is  the 
  77.         default;  the  cursor  changes  to a block when in insert mode).  
  78.         Ctrl-left and Ctrl-Right will move left and right a  word  at  a 
  79.         time.   Home  goes to the beginning of the line, End to the end. 
  80.         Ctrl-Home will delete all characters to the left of the  cursor, 
  81.         Ctrl-End  will delete all characters to the right of the cursor.  
  82.         The Escape key will delete the current line.  So far nothing  is 
  83.         really  unusual,  though the ability to move without deleting is 
  84.         handy.  Also worth noting is the fact that the cursor  does  not 
  85.         need to be at the end of the command line to press <Enter>.  All 
  86.         characters  in  the command line are processed regardless of the 
  87.         current cursor position.
  88.         
  89.         The up arrow and down arrow trigger command  line  recall.   The 
  90.         last  32  commands  are  held in a queue.  Pressing the up arrow 
  91.         will bring the previous command in the queue, pressing the  down 
  92.         arrow  will  bring  up the next.  The queue wraps around, so you 
  93.         may cycle through it continuously.  When a line from  the  queue 
  94.         is  brought  to  the  screen,  it  may  be editted with the keys 
  95.         described above.  If the line is changed, it is added to the end 
  96.         of the queue.  If it is unchanged, it is simply reused,  without 
  97.         being  added to the queue.  This can be sometimes confusing, but 
  98.         has the benefit that command lines tend to  stay  in  the  queue 
  99.         longer,  and  may be reused many times without causing the queue 
  100.         to fill  with  duplicates.   The  queue  may  be  flushed  using 
  101.         Ctrl-PgUp.  This is handy for removing incriminating evidence of 
  102.         games playing.
  103.         
  104.         In addition to the command line recall, several other  keys  are 
  105.         available   to  make  command  line  entry  easier.   For  users 
  106.         accustomed to VMS, Ctrl-R will start a new  line  and  redisplay 
  107.         the command line.  This is rarely used but sometimes useful.  In 
  108.         the  same  vein,  Ctrl-X  and Ctrl-U function the same as <Esc>, 
  109.         cancelling the current command.
  110.         
  111.         Ctrl-T will print the current date and time, without affecting 
  112.         the command line.
  113.         
  114.         Ctrl-D  and  Ctrl-F attempt filename completion, much as is done 
  115.         in the Unix raw shell.  When Ctrl-D is pressed, the  word  under 
  116.         the  cursor  is treated as a path/file name.  Next the directory 
  117.         is searched for any files  starting  with  the  fragment.   (For 
  118.         example,   if  c:\tools\sc^D  is  entered,  spawn  searches  for 
  119.         c:\tools\sc*.*).  If only one file matches, the remainder of the 
  120.         file name is filled in for you, and the cursor advanced  to  the 
  121.         end of the completed name.  If multiple files match, the name is 
  122.         completed  as  far  as  possible  until  the  the  possibilities 
  123.         diverge.  (In the above example, if the  files  scanner.dat  and 
  124.         scanrun.dat  were  present,  the  name  would be completed until 
  125.         c:\tools\scan).  All of the possibilities are displayed  on  the 
  126.         screen,  so  you may choose from the alternatives.  You may then 
  127.         enter another character or two and press Ctrl-D to fill  in  the 
  128.         rest,  or  type  the  rest  in  manually.   Though  this  sounds 
  129.         confusing, it is really quite simple.  Ctrl-F  is  the  same  as 
  130.         Ctrl-D,   but   merely   lists  all  the  possibilities  without 
  131.         attempting to complete the name on the command  line.   This  is 
  132.         useful  if  you are not sure which file you want and need to jog 
  133.         your memory.  Together Ctrl-D and Ctrl-F  can  greatly  simplify 
  134.         the  entry of pathnames from the keyboard.  Both also understand 
  135.         logical names, and will translate  them  as  required  (see  the 
  136.         section on logical names).
  137.         
  138.         
  139.     1.3  Operations
  140.         
  141.         Spawn acts just like command.com, in that you type  commands  at 
  142.         the prompt and they get executed.  You do not generally care how 
  143.         the are executed, so long as they get done.  
  144.         
  145.         Command.com   divides   commands  into  two  different  classes: 
  146.         internal and external.  Internal commands are  those  for  which 
  147.         the code resides directly in command.com and is called directly.  
  148.         External  commands  are  those  which  are  contained in another 
  149.         program and which must be loaded from disk.
  150.         
  151.         Spawn is the same way; it has  a  number  of  internal  commands 
  152.         which  are  performed by spawn itself.  Anything that it can not 
  153.         recognize as an internal  command  it  simply  passes  along  to 
  154.         command.com,  which  in  turn  decides  if  it  is  internal  or 
  155.         external.  This is required because spawn does not replicate all 
  156.         of the internal functions of command.com.
  157.         
  158.         Having said all this, it should be  obvious  (or  at  least  not 
  159.         surprising),  that the only things that are different when using 
  160.         spawn are spawn's own internal commands.   The exception to this 
  161.         is the spawn keyboard interface as described above.
  162.         
  163.  
  164.     2.0  Commands        
  165.         
  166.         Spawn has a large number of internal commands.  Some provide  no 
  167.         additional  functionality  over  command.com,  but  are included 
  168.         simply because they are done so many times.
  169.  
  170.                 
  171.         DEF*INE  SYMBOL  TRANSLATION
  172.         ----------------------------
  173.         
  174.         The define command creates symbols.  A symbol consists of a  tag 
  175.         and its translation.  Generally a symbol is used to abbreviate a 
  176.         long  command  line  or  portion thereof, or to tie a particular 
  177.         command to a function key.
  178.         
  179.         For example, consider the command
  180.         
  181.         define bkp backup c:\sct21\*.* a: /s/m:12-25-88
  182.         
  183.         The keyword define says that we  are  creating  a  symbol.   The 
  184.         symbol  is  bkp,  and its translation is "backup c:\sct21\*.* a: 
  185.         /s/m:12-25-88".   Once  defined,  if  you  type  "bkp"  at   the 
  186.         keyboard,  the  command  "backup  c:\sct21\*.* a: /s/m:12-25-88" 
  187.         will be executed.  This is the simplest form of  a  symbol,  and 
  188.         serves only to reduce the number of keystrokes you must type.
  189.  
  190.         Consider   the   problem   of  navigating  between  directories.  
  191.         Directories are tree structured, and it is not uncommon for  you 
  192.         to  think  of  something as being a level higher or lower in the 
  193.         tree, or on the same level but a different branch.  DOS provides 
  194.         the capabilities for  navigating  the  tree,  which  are  seldom 
  195.         exploited.   Few realize that the command "cd .." will change to 
  196.         the parent directory (same branch, one level  up)  or  that  "cd 
  197.         ..\sibling" will go up and over.  The command "cd child" will go 
  198.         one  level  down  in  the  tree.  These commands are seldom used 
  199.         partly because of the awkardness of typing "..\".  Consider  the 
  200.         following symbols:
  201.         
  202.         define side cd ..\
  203.         define up cd ..
  204.         define down cd 
  205.         
  206.         Typing  "side  sibling"  translates  to  "cd  ..\sibling" (it is 
  207.         important that there be no trailing spaces after  the  ..\  when 
  208.         the  define  is done, since we wish the sibling to bind directly 
  209.         to  the  ..\,  and  not  as  "..\  sibling").   Similarly   "up" 
  210.         translates  to "cd ..". These shorthands are very convenient for 
  211.         traversing large directory trees.
  212.         
  213.         The astute reader may have noticed  that  the  heading  of  this 
  214.         section  said  "DEF*INE".   The  asterisk  is part of the symbol 
  215.         definition.   Its  presence  indicates  the  minimum  acceptable 
  216.         abbreviation for the symbol.  "def*ine" says that "def", "defi", 
  217.         "defin",  and  "define"  are  all  valid,  but  "de", "defo" and 
  218.         "defile" are not.  An asterisk can be placed in  any  symbol  to 
  219.         define the minimal abbreviation.
  220.  
  221.         Function  keys  can  be defined as symbols.  Any symbol with the 
  222.         form "define funct_keyN", where N is the number  of  a  function 
  223.         key,  defines  that function key as a symbol. Function keys will 
  224.         take precedence over whatever command line  is  displayed;  that 
  225.         is,  if  a function key is pressed while a command line is being 
  226.         built, only the function key press is processed.  Function  keys 
  227.         are  always  acted  on  immediately,  so they can not be used to 
  228.         enter partial commands.  You can think of  pressing  a  function 
  229.         key  as the equivalent of <Esc>, function key, <Enter>.  Only F1 
  230.         - F10 may be defined, using the syntax  funct_key1,  funct_key2, 
  231.         etc.
  232.         
  233.         Once  created,  symbols  can  not be deleted, though they can be 
  234.         changed  by  defining  the  same   symbol   with   a   different 
  235.         translation.  The definition of all symbols can be list by using 
  236.         the "show sym" command.  
  237.  
  238.  
  239.         ALIAS LOG_NAME PHYS_NAME
  240.         ------------------------
  241.         
  242.         The  alias  command  defines  a logical name.  Logical names are 
  243.         similar to symbols but different in scope and grouping.   To  be 
  244.         translated, a symbol must always be the first token (basically a 
  245.         word)  on the command line.  Symbol translation is single level, 
  246.         and is assisted with the abbreviation logic.
  247.         
  248.         Logical names are intended to serve as  shorthand  for  file  or 
  249.         path  names,  but  can  be  treated  similarly to symbols.  When 
  250.         encountered anywhere on the command line, the  logical  name  is 
  251.         translated to its physical name.
  252.         
  253.         For example, consider the following:
  254.         
  255.         alias bootdir c:\system\boot
  256.         dir bootdir
  257.         
  258.         The  alias  command defines the logical name bootdir to mean the 
  259.         directory c:\system\boot.  The dir command will list all of  the 
  260.         files  in  the  directory  c:\system\boot.   So far this is very 
  261.         similar to symbol translation.  However, a logical name  can  be 
  262.         combined with a physical name using a colon (:).
  263.         
  264.         alias bootdir c:\system\boot
  265.         dir bootdir:vdisk.sys
  266.         
  267.         The   dir   command   in   this   instance   translates  to  dir 
  268.         c:\system\boot\vdisk.sys.  When a logical  name  is  translated, 
  269.         the translation routine decides whether the colon should be left 
  270.         in  place,  omitted, or translated to a '\'.  It always attempts 
  271.         to turn the physical name into a file name if possible.
  272.         
  273.         Logical name translation is recursive; consider
  274.         
  275.         alias bootdir c:\system\boot
  276.         alias ramdriver bootdir:vdisk.sys
  277.         
  278.         To  resolve  ramdriver,  the  logical  name  bootdir   must   be 
  279.         translated,    so    the   definition   of   ramdriver   becomes 
  280.         "c:\system\boot\vdisk.sys".        
  281.         
  282.         More than one logical name can appear on a line.  Consider
  283.         
  284.         alias rev20  c:\sct20\source
  285.         alias rev21  d:\sct21\source
  286.         copy rev20:*.c rev21:*.old
  287.         
  288.         In this instance both logicals are translated, so the  resulting 
  289.         command is "copy c:sct20\source\*.c d:\sct21\source\*.old".
  290.         
  291.         Once assigned, logical names remain in  effect  until  destroyed 
  292.         with  the DEASS command.  Logical names are translated by Ctrl-D 
  293.         and Ctrl-F, but are not completed by them.   The  definition  of 
  294.         all  current  logical  names  can  be listed with the "show log" 
  295.         command.
  296.  
  297.         
  298.         DEASS*IGN LOG_NAME
  299.         ------------------
  300.         
  301.         This  command  is  the  opposite  of alias.  It removes from the 
  302.         logical name table the logical name specified.
  303.         
  304.                 
  305.         VE*DIT  EDITOR_PARAMS
  306.         ---------------------
  307.  
  308.         The ved command is designed to work with a text  editor  (in  my 
  309.         case,  not suprisingly, vedit), but can really be applied to any 
  310.         program.  What it does, is examine the command  line  associated 
  311.         with  the  command;   if  it is not null, it saves it.  If it is 
  312.         null, it appends the last value  of  the  command  line  to  the 
  313.         translation  of  the  symbol  and  executes  that.   Though  the 
  314.         description is rather long winded,  the  explanation  is  simple 
  315.         enough;  if  you  do  not supply a filename to a text editor, it 
  316.         will start up with the last one you worked on.  When a file name 
  317.         is saved, it is expanded into  a  complete  filespec,  including 
  318.         drive  and directory.  In this way, the default directory may be 
  319.         changed, but the editor will still  edit  the  same  file.   The 
  320.         actual program executed by the vedit command is the value of the
  321.         environment variable VEDEXE.  For example:
  322.         
  323.         set VEDEXE=c:\jfe\vedit.com
  324.         spawn
  325.         vedit config.sys
  326.         Editing file: c:\config.sys
  327.         (do your editing here...)
  328.         vedit
  329.         Editing file: c:\config.sys
  330.         (do your editing here...)
  331.         
  332.         The  vedit  command  has  some smarts; if there is more than one 
  333.         token on the command line it will not attempt to expand out file 
  334.         specs, and if the file spec contains a \ or : it assumes  it  is 
  335.         already a pathname and will not try to expand it.
  336.         
  337.         Under OS/2 more applications are smart enough to remember what 
  338.         they were doing before exiting, and this command is not needed
  339.         nearly as often.  What I have done in OS/2 is to reassign this
  340.         command so that it invokes make with the last makefile used.
  341.         The proper commands are (these should go in spinit.spn):
  342.         
  343.         define ve*dit mep   ; this switches the normal vedit to mep
  344.         define make $$i     ; define make to internal command i
  345.         define funct_key5 ved   ; keep f5 as editor invocation
  346.         define funct_key6 $$i   ; but make f6 remember the command line
  347.         
  348.         Then in you config.sys for OS/2, place the following:
  349.         SET VEDEXE=<your make path>make.exe
  350.  
  351.         
  352.         DIR*ECTORY and FDIR*ECTORY
  353.         --------------------------
  354.  
  355.         One of the more obnoxious commands in PC-DOS is the dir command.  
  356.         Its  chief  offenses  are that it does not sort the files before 
  357.         displaying them, it does not give the total size  of  the  files 
  358.         listed,  it does not display the attributes of the files, and it 
  359.         will only accept a single specification at a  time.   The  spawn 
  360.         dir  command  fixes  all  of these problems.  Syntactically, the 
  361.         format of the command is:
  362.         
  363.         [f]dir[ectory] [file_spec [file_spec [file_spec... ]]] [/p][/w]
  364.         
  365.         That  is,  the  word  dir  or  fdir,  followed  by  zero or more 
  366.         path/file specifcations.  The actual rules for interpreting  the 
  367.         file   specifications   are   surprisingly  complex,  but  quite 
  368.         intuitive if you are used to the DOS version of the command.
  369.         
  370.         If the /p qualifier is present,  the  display  will  stop  every 
  371.         screenful   and  prompt  for  a  key  before  continuing.   This 
  372.         qualifier may appear anywhere on the command line.  In DOS spawn 
  373.         always assumes that a screen is 25 lines.  In OS/2 it is smarter 
  374.         and will use the proper number of lines when /p  is  used.   (If 
  375.         you  are  running in a window, the number of screen lines is the 
  376.         number of lines the window would have when  maximized,  not  the 
  377.         number  of  lines displayable at the current size of the window.  
  378.         The scroll bars on the window can move around  within  the  full 
  379.         screen size).
  380.  
  381.         The /w qualifier displays only  the file names, and  displays as
  382.         many as possible on each line.  Directories are preceded with an
  383.         asterisk (*).
  384.  
  385.         The  output from spawn is sorted alphabetically by name (to make 
  386.         directory management easier, subdirectories always appear at the 
  387.         beginning of the display), with the file attributes shown at the 
  388.         beginning of the line.  The three possible  attributes  are  'r' 
  389.         for read only, 'h' for a hidden file, and 's' for a system file.  
  390.         Absence  of  an  attribute is indicated by a dash (-), so normal 
  391.         files will be preceded by a "---" on the directory listing.  The 
  392.         dir command will not display hidden or system files,  while  the 
  393.         fdir command will.  Otherwise the two commands are identical.
  394.         
  395.         Entry of multiple file specifications to the dir command 
  396.         complicates matters.  For example, the command:
  397.         
  398.         dir *.c *.lst
  399.         
  400.         will show all of the .c and .lst files on the current directory, 
  401.         sorted by alphabetical order.  So far, so good.  The command:
  402.         
  403.         dir c:\*.sys c:\system\boot\*.sys
  404.         
  405.         will show all of the .sys files in both directories --  however, 
  406.         because  multiple  directories  are involved, the directory name 
  407.         will be shown preceding each file, and the sorting will sort  by 
  408.         the  full  pathname, grouping all of the files in each directory 
  409.         together.  In contrast, the command:
  410.         
  411.         dir sl:*.c sl:*.obj   (where sl is a logical name)
  412.         
  413.         will translate the the logical name sl, then give a directory of 
  414.         all the .c and .obj files on the directory that sl evaluates to. 
  415.         In  this  case,  since  all  of  the  files  reside  on the same 
  416.         directory, only the file names are displayed. Finally a  command 
  417.         like:
  418.         
  419.         dir *.c .\*.c *.c
  420.         
  421.         will  produce  a  list  of  all  the  .c  files  on  the current 
  422.         directory, and a list of the same files preceded by ".\".   This 
  423.         is   because  so  far  as  spawn  is  concerned,  two  different 
  424.         directories are  involved:  the  current  (no  string)  and  the 
  425.         directory   ".\"  (which  evaluates  out  to  mean  the  current 
  426.         directory).  The duplicate *.c specs do not  bother  it  --  the 
  427.         duplicates created there will be flushed and only displayed once 
  428.         --  but  it  will be fooled by the ".\".  The moral of the story 
  429.         here is that if you don't try to fool spawn it won't try to fool 
  430.         you.
  431.         
  432.         
  433.         DEL*ETE and XDEL*ETE
  434.         --------------------
  435.         
  436.         Spawn replaces the del command from PC-DOS with its own  version 
  437.         (by  default ERASE is not defined, and will invoke the DOS erase 
  438.         command), which has much of the same enhancements that  the  dir 
  439.         command  does.   It  accepts multiple specifications on the same 
  440.         command, and has a /v option that prints out the  name  of  each 
  441.         file as it is deleted.  Syntactically, the command is:
  442.         
  443.         [x]del[ete] file_spec [ file_spec... ] [/v]
  444.         
  445.         Up  to  ten different file specifications can be included on the 
  446.         command line.  Unlike DOS, the spawn  delete  command  does  not 
  447.         prompt  with "Are you sure?" if the file specification evaluates 
  448.         out to *.*.  If you ask for *.*, you get *.* with no backtalk.
  449.         
  450.         The xdel command is similar to del, but deletes all of the files 
  451.         except those listed.  For instance,
  452.         
  453.         xdel *.c makefile.*
  454.         
  455.         will delete all the files on the current directory except  those 
  456.         with  a .c extension or a name portion of makefile.  Overlapping 
  457.         specifications (in this instance a  file  makefile.c)  cause  no 
  458.         problems.
  459.         
  460.         Xdel attempts to establish a target directory for its deletions. 
  461.         It   need   not   be   the   current  directory,  but  all  file 
  462.         specifications must evaluate out to  the  same  directory.   For 
  463.         instance, the command
  464.         
  465.         xdel c:\*.sys c:\system\boot\*.sys
  466.         
  467.         will  give  an  error message to the effect that only one target 
  468.         directory can be referenced, while the command
  469.         
  470.         xdel c:\system\boot\*.sys c:\system\boot\*.drv
  471.         
  472.         would  work   without   complaint,   deleting   all   files   on 
  473.         c:\system\boot that do not end .sys or .drv.
  474.         
  475.         Xdel  also  supports the /v option (which may be anywhere on the 
  476.         command line), to print out the name of each file that is  being 
  477.         deleted  or  preserved.   Xdel is vulnerable to confusion in the 
  478.         same way  that  the  dir  command  is,  by  pathnames  that  are 
  479.         different  but actually refer to the same path; in this instance 
  480.         it will give the error about multiple target directories.
  481.         
  482.         
  483.         SDIR and RDIR
  484.         -------------
  485.  
  486.         The  sdir  command  simply  saves the  current default drive and 
  487.         directory for later use.  It produces no output.   This  command 
  488.         is automatically executed when spawn is started.
  489.         
  490.         The rdir command will set the default drive and directory to the 
  491.         values saved by sdir.  Again, no output is produced.
  492.         
  493.         You may find it handy to tie these commands to function keys, so 
  494.         that they can be quickly invoked:
  495.         
  496.         def funct_key7 sdir
  497.         def funct_key8 rdir
  498.  
  499.         
  500.         COLOR
  501.         -----
  502.         
  503.         The color command sets the color that spawn  will  use  for  its 
  504.         output  and  the  output of programs that it calls, unless those 
  505.         programs override it with their own color setting (as most  do). 
  506.         The syntax is:
  507.         
  508.         color [bright] foreground_color on background_color
  509.         
  510.         where  foreground_color  and  background_color  must  be one of: 
  511.         black, blue, green, cyan, red, magenta, yellow  or  white.   The 
  512.         bright parameter is optional and will cause the foreground color 
  513.         to  be high intensity.  Good choices for color are white on blue 
  514.         and green on black, but by all means experiment.
  515.         
  516.         Color  setting  is  done  primarily  through  ansi.sys,  so  the 
  517.         ansi.sys  device  driver  must  be  installed in your config.sys 
  518.         file.  Failure to install ansi.sys will not  cause  catastrophic 
  519.         errors, but output will look somewhat odd.
  520.         
  521.         The default color setting is green on black.
  522.  
  523.                         
  524.         PTOG
  525.         ----
  526.         
  527.         The ptog command stands for "prompt toggle".  Unlike PC-DOS (and 
  528.         one  of  the  few  areas  where  spawn  is  not  as versatile as 
  529.         command.com), the prompt in spawn is not defineable.  By default 
  530.         the prompt is the volume name of the  default  drive  (or  drive 
  531.         letter  if  the  default  drive  is unlabelled), followed by the 
  532.         default  directory  and  a  greater  than  sign.   If  this   is 
  533.         undesirable,  or  too  long,  the ptog command will minimize the 
  534.         prompt.  Typing ptog again will change it back.
  535.  
  536.         In  real  mode  (DOS  or  OS/2 compatibility mode) the prompt is 
  537.         preceded by an (R) to indicate real  mode.   In  OS/2  protected 
  538.         mode  the  prompt  is proceeded by the session nickname, such as 
  539.         (Bert).  When minimized, the real mode prompt  is  R$,  and  the 
  540.         OS/2 prompt is n$, where n is the ordinal number of the session. 
  541.         (Ordinal numbers are generally assigned in the order of startup, 
  542.         until  one  session  terminates,  in which case the next startup 
  543.         will reuse its ordinal number.  See the section on OS/2 for more 
  544.         on this stuff).
  545.  
  546.  
  547.         HIST
  548.         ----
  549.  
  550.         This  command  simply lists the commands in the keyboard history 
  551.         queue.  The last 32 commands are saved,  not  counting  function 
  552.         key presses or commands that were reused from the queue.
  553.  
  554.         
  555.         SHOW { MEM*ORY LOG*ICAL SYM*BOLS VED*IT VER*SION }
  556.         --------------------------------------------------
  557.         
  558.         The show command requires one  of  the  arguments  shown  above.  
  559.         Each produces different output.
  560.         
  561.         SHOW MEM will display the amount  of  memory  installed  (up  to 
  562.         640KB),  the  amount  used  by  the system (DOS, device drivers, 
  563.         TSR's, etc.), the amount used by spawn, and the amount available 
  564.         for programs called by spawn.  This last value will generally be 
  565.         about 4K more than  the  value  shown  by  the  chkdsk  command, 
  566.         because  of the overhead incurred by calling command.com to call 
  567.         chkdsk.
  568.         
  569.         In  OS/2  protected  mode the  show mem command is not nearly as 
  570.         interesting.  It shows the approximate size of the spawn program 
  571.         itself (not counting environment and  shared  memory),  and  the 
  572.         size  of  the  largest remaining free block.  This is the amount 
  573.         that is available for other applications to use.  This  may  not 
  574.         represent  the  true  amount  of memory remaining in the system, 
  575.         since OS/2 may well be able to coalesce free blocks if a request 
  576.         is made for a block exceeding the remaining size.   The  virtual 
  577.         memory  aspects of OS/2 and the MEMMAN command in the config.sys 
  578.         file give it considerable flexibility to find memory.
  579.         
  580.         SHO  LOG  will display the logical and physical names of all the 
  581.         defined logicals.
  582.         
  583.         SHO SYM will display the symbol and translation for all  of  the 
  584.         symbols defined.
  585.         
  586.         SHO  VED  will display the program tied to the vedit command and 
  587.         the currently saved command line for that program.
  588.  
  589.         SHO VER will display the version level of spawn.
  590.  
  591.         
  592.         KILL
  593.         ----
  594.         
  595.         This command exits  spawn,  returning  you  to  command.com  (or 
  596.         whatever program invoked spawn).
  597.  
  598.  
  599.         CLS and CD and SET
  600.         ------------------
  601.         
  602.         These  commands  do nothing that command.com doesn't do, but are 
  603.         implemented in spawn so that a copy of command.com doesn't  have 
  604.         to be loaded just to do these trivial functions.
  605.         
  606.         Additionally,  SET is internal because copies of the environment 
  607.         are always passed by value, so it is not generally possible  for 
  608.         one  program to modify anothers environment.  Spawn will inherit 
  609.         the DOS environment, but after that maintains its own.
  610.  
  611.         Changing  drives  is  also  done  internally  (a command such as 
  612.         "d:"), because in OS/2 the notion of default drive and directory 
  613.         are local to a process and no other process can  change  spawn's 
  614.         default drive and dir. 
  615.  
  616.  
  617.         @ COMMAND QUALIFIER
  618.         -------------------        
  619.         
  620.         Technically  speaking,  @  is  a  command  qualifier  and  not a 
  621.         command, but it helps to think of it as  a  command  in  and  of 
  622.         itself.  The presence of an @ sign preceding a command indicates 
  623.         that the next token on the command line is a filename containing 
  624.         commands  for  spawn to execute (analogous to a DOS batch file). 
  625.         The file is presumed to have an extension of  .SPN,  and  to  be 
  626.         either  on  the current directory or in the directory referenced 
  627.         by the SPFILS environment variable. Any spawn or DOS command can 
  628.         be executed inside of a spawn file, though the DOS commands that 
  629.         work only within batch files are not available.  Spawn will  not 
  630.         echo  the contents of .spn files.  When all commands in the file 
  631.         have been read, input is reattached to the keyboard.
  632.  
  633.         
  634.         & COMMAND QUALIFIER
  635.         -------------------
  636.  
  637.         The & is also a command qualifier.  It tells spawn that  instead 
  638.         of  invoking  command.com to execute the command line, the first 
  639.         token should be treated as a program name and executed directly, 
  640.         without going through command.com.  This is slightly faster, and 
  641.         saves about 4KB of  memory,  but  will  not  work  for  commands 
  642.         internal to command.com, and commands which are not well behaved 
  643.         about reading their command line.
  644.  
  645.         This  command  will  search  the current PATH for the file to be 
  646.         executed.
  647.  
  648.         This  qualifier  is  also  available  in  OS/2,  but  to   avoid 
  649.         conflicting  with the normal usage of the & in OS/2, it has been 
  650.         changed to the right bracket character "]".
  651.         
  652.                 
  653.         OS/2 PROTECTED MODE
  654.         -------------------
  655.         
  656.         The program spawnp.exe is an  OS/2  protected  mode  version  of 
  657.         spawn.   In  general the two behave identically, with the slight 
  658.         differences noted in the descriptions above.  However, the  OS/2 
  659.         version  has a different prompt scheme (as described in the PTOG 
  660.         command), and has two commands that are  not  available  in  DOS 
  661.         mode.
  662.  
  663.         
  664.         HIGHT nickname  (OS/2 only)
  665.         ---------------------------
  666.             
  667.         This command changes the session nickname. The session  nickname 
  668.         is  the word displayed in parentheses before the volume label as 
  669.         part of the prompt.  If the nickname is blank the  current  name 
  670.         is printed.  Nicknames can consist of any ASCII characters up to 
  671.         a length of 31.
  672.  
  673.         This command is not available in DOS (real) mode.
  674.             
  675.             
  676.         SYNC {/query | /notify | /nonotify} [nickname] (OS/2 only)
  677.         ----------------------------------------------------------
  678.             
  679.         The sync command is used to (what else)  synchronize  processing 
  680.         between  multiple OS/2 sessions.  It's intended usage is to give 
  681.         you  a  quick  method  of  checking  on  another  process.   For 
  682.         instance,  suppose  you  are  using  3  screen  groups:  an edit 
  683.         process, a compile process, and a test environment.  You edit  a 
  684.         file,  flip  over to the compiler process to compile, go back to 
  685.         the editor and edit some more, then want to know if the  compile 
  686.         has  finished  so  you can test.  You Alt-Tab through all screen 
  687.         groups until you find the right  process,  discover  it  is  not 
  688.         done, then Alt-Tab back.  All in all, a laborious process.
  689.             
  690.         With spawn, you use:
  691.             
  692.         sync /query Bert
  693.          
  694.         spawn responds with
  695.             
  696.         Bert is busy doing "make"
  697.             
  698.         or 
  699.             
  700.         Bert is idle.
  701.             
  702.         Bert  in  this instance is a session nickname.  Sync /query is a 
  703.         single check on the status of a session, or, if no  nickname  is 
  704.         given, all sessions.
  705.             
  706.         sync  /notify  is  slightly  more  sophisticated.   If notify is 
  707.         turned on (it is enabled for all sessions by default),  whenever 
  708.         another session completes a command while in the background, the 
  709.         foreground session will display a message of the form
  710.             
  711.         session has finished "command"
  712.             
  713.         where "session" is the session nickname  and  "command"  is  the 
  714.         command that was just executed.  /notify is only operative while 
  715.         spawn  is  in  the  foreground  and  is  taking  input  from the 
  716.         keyboard.  sync /nonotify disables  notify  mode  for  either  a 
  717.         single session or for all sessions if no name is given.
  718.             
  719.         This command is not available in DOS (real) mode.
  720.         
  721.  
  722.         
  723.         QUICK REFERENCE
  724.         ---------------
  725.         
  726.         Getting started: 
  727.         
  728.         Spawn uses two environment variables:
  729.         
  730.             VEDEXE should be set to the full pathname of the program to be 
  731.                    used with the vedit command.
  732.         
  733.             SPFILS should be set to the directory where .spn (spawn batch 
  734.                    files) can be found.  This specification must include 
  735.                    a trailing backslash (i.e. c:\spawn\)
  736.                 
  737.         The file spinit.spn (in the SPFILS directory) is executed upon 
  738.         startup.
  739.         
  740.         In DOS, start spawn with:
  741.         
  742.             spawn /maxdir:n  (a good value for n is 250)
  743.         
  744.         in OS/2, start spawn with
  745.         
  746.             spawnp /maxdir:n  (again, n=250 is about right).
  747.         
  748.         
  749.         KEYBOARD ENHANCERS:
  750.             Ctrl-D    Complete filename
  751.             Ctrl-F    List matching filenames
  752.             Ctrl-T    Display date and time
  753.             Ctrl-R    Repaint current command line
  754.             Esc       Delete current command line
  755.             Ins       Toggle between Insert and typeover modes
  756.             Up arr    Restore previous command line from queue
  757.             Dn arr    Restore next command line from queue
  758.             Lft arr   Move cursor left
  759.             Rgt arr   Move cursor right
  760.             Home      Move cursor to beginning of line
  761.             End       Move curosr to end of line
  762.             Ctrl-Rft  Delete all characters to left of cursor
  763.             Ctrl-Rgt  Delete all characters to right of cursor
  764.             Ctrl-PgUp Delete queue of previous commands
  765.         
  766.  
  767.  
  768.         COMMANDS:
  769.         
  770.             DEF*INE  SYMBOL  TRANSLATION
  771.                 Define a symbol
  772.                 
  773.             ALIAS LOG_NAME PHYS_NAME
  774.                 Define a logical name
  775.  
  776.             DEASS*IGN LOG_NAME
  777.                 Destroy a logical name
  778.         
  779.             VE*DIT  [EDITOR_PARAMS]
  780.                 Invoke a text editor, restoring last command line if 
  781.                 none given
  782.         
  783.             [F]DIR[ECTORY] [FILE_SPEC [FILE_SPEC...]] [/P][/W]
  784.                 Display a directory for normal files (dir) or all  files 
  785.                 (fdir).  Pause every screenful if /p is given. Display 
  786.                 in wide format if /w is given.
  787.         
  788.             [X]DEL[ETE] FILE_SPEC [ FILE_SPEC... ] [ /V ]
  789.                 Delete  files  (del)  or  delete all but specified files 
  790.                 (xdel).  Be verbose if /v is given.
  791.  
  792.             SDIR 
  793.                 Save current drive and directory.
  794.                         
  795.             RDIR
  796.                 Set default drive and directory to those saved by SDIR.
  797.                 
  798.             COLOR [BRIGHT] FOREGROUND_COLOR ON BACKGROUND_COLOR
  799.                 Set colors to use for display.
  800.         
  801.             PTOG
  802.                 Toggle prompt between default and minimized.
  803.                 
  804.             HIST
  805.                 Show contents of history buffer.
  806.         
  807.             SHOW { MEM*ORY LOG*ICAL SYM*BOLS VED*IT VER*SION }
  808.                 Show things.
  809.         
  810.             KILL
  811.                 Terminate spawn
  812.         
  813.             @ COMMAND QUALIFIER
  814.                 Invoke a spawn batch file.
  815.         
  816.             & COMMAND QUALIFIER
  817.                 Call a program directly (no command.com or cmd.exe)
  818.         
  819.             HIGHT nickname  (OS/2 only)
  820.                 Set the session nickname.
  821.         
  822.             SYNC {/query | /notify | /nonotify} [nickname] (OS/2 only)
  823.                 Query the status of another spawn session, or enable and 
  824.                 disable sync notifications.
  825.                 
  826.         
  827.         TECHNICAL NOTES
  828.         ---------------
  829.         
  830.         Spawn is written entirely in  MicroSoft  C,  version  5.1.   Its 
  831.         roots  go  back  to 1984, when version 1 was written in Aztec C.  
  832.         Spawn has grown over the years, and now bears little resemblence 
  833.         to the original.  Portions of the original code still survive as 
  834.         a testament to how ugly the code that is written by a  beginning 
  835.         C programmer can be.
  836.         
  837.         As of version 2.0,  spawn  is  spread  across  4  source  files.  
  838.         spawn.c  contains  the  bulk  of  the  code,  and  is  primarily 
  839.         concerned  with actually  implementing  the  commands.   Input.c 
  840.         contains  the  keyboard  routines and various support functions.  
  841.         Both of these source files are compatible  with  both  OS/2  and 
  842.         DOS.   The other two source files are sysdep-p.c and sysdep-r.c, 
  843.         and are the system dependent functions for  protected  and  real 
  844.         mode.    These  files  have  the  same  entry  points,  but  the 
  845.         implementation of the functions is different.  The  DOS  version 
  846.         links with sysdep-r and the OS/2 version links with sysdep-p.
  847.         
  848.         I  have  never  claimed  that  spawn  is the best product in its 
  849.         class, or that its quality is all it could be.  Much of the code 
  850.         could be smaller and cleaner, and the  source  documentation  in 
  851.         particular  ranges from nonexistent to out of date.  All of that 
  852.         said, it works and I  know  what  does  what,  so  it  meets  my 
  853.         purposes.   If  there is a function you would like to see added, 
  854.         you can take a crack at it yourself, or let me know  and  I  may 
  855.         try  it.  As of the moment I have no major features planned -- I 
  856.         am most likely to spend the effort to try and get the amount  of 
  857.         memory consumed in real mode down.
  858.         
  859.         Happy computing.
  860.         
  861.         
  862.         
  863.