home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / enterprs / cpm / utils / f / lu3.arc / LU.DOC < prev   
Encoding:
Text File  |  1993-03-23  |  35.1 KB  |  656 lines

  1.  
  2.  
  3.  
  4.                         Documentation for LU.COM and LRUN.COM
  5.         
  6.          This  document applies to version 3.00 of LU.COM and version 2.0  of 
  7.         LRUN.COM.
  8.         
  9.          Copyright (c) 1982, 1983 by Gary P. Novosielski All rights reserved.
  10.         
  11.          Permission  is  hereby granted to copy and distribute this  document 
  12.         for any non-commercial purpose.  Any use of this material for commer-
  13.         cial advantage without prior written consent of the author is  prohi-
  14.         bited.
  15.         
  16.                                     INTRODUCTION
  17.         
  18.          Library  Utility  (LU) is a program to allow combining of  multilple 
  19.         files into one larger file. It requires CP/M version 2.0 or higher to 
  20.         run.  Version 3.00 replaces version 2.11.       The major revisions 
  21.         are the addition of the -b, and -n operators, and the addition of CRC 
  22.         calculation and checking to improve reliability.  Error reporting has 
  23.         also been improved.
  24.         
  25.          The directory information in an LU style library is contained in the 
  26.         same file as the data files,  or members.  The amount of space to  be 
  27.         allocated  to the directory must be specified by the user when a  new 
  28.         library is created,  but can be changed when the file is reorganized. 
  29.         The  size of each directory entry is 32 bytes,  which means each four 
  30.         directory entries take up one sector of the library  file.  Currently 
  31.         only  18 bytes of each entry are used,  with 14 bytes being  reserved 
  32.         for use with possible future enhancements.  The directory itself uses 
  33.         one entry for control information, so the number of directory sectors 
  34.         needed  for a library of m members is (m + 1) / 4,  rounded up to the 
  35.         next whole number.
  36.         
  37.          The  user need not be concerned with this discussion,  as  directory 
  38.         size is calculated by the program.  All directory sizes are input and 
  39.         output in terms of entries, each entry being a potential member file. 
  40.         The program adjusts directory size to an integral number of sectors.
  41.         
  42.          LRUN.COM  is  a small program which allows running  a  .COM  (object 
  43.         code)  file member directly from any library,  without having to  ex-
  44.         tract it to a separate disk file.
  45.         
  46.                                  WHY USE LIBRARIES?
  47.         
  48.          First,  a library file usually takes up less space than the total of 
  49.         the  individual member files which went into it.  The reason for this 
  50.         is that CP/M allocates disk space in fixed blocks or groups, typical-
  51.         ly 2k bytes each. Any space after the last sector of a file up to the 
  52.         next  2k block boundary is wasted.  The same files in a  library  use 
  53.         only the number of sectors they actually need, and though the library 
  54.         itself  may  have a partially wasted block at the end,  and  requires 
  55.         some space for directory information at the beginning, the net effect 
  56.         is  usually a saving of total space.  The best results are seen  when 
  57.         many small files are combined into one library.
  58.         
  59.          Second,  a  library file makes most efficient use of the  CP/M  disk 
  60.         directory, since it is treated as only one file by CP/M regardless of 
  61.         how many members it contains.
  62.         
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.          Third,  libraries  can aid in transferring packages of software from 
  70.         one  system to another using XMODEM.  Only one file  is  transferred, 
  71.         eliminating  the  need  to run the XMODEM  transfer  program  several 
  72.         times,  the chance of overlooking a needed file,  and the problems of 
  73.         naming conflicts, (such as READ.ME files) among unrelated packages.
  74.         
  75.                                WHY NOT USE LIBRARIES?
  76.         
  77.          There are some very good reasons for not using libraries.
  78.         
  79.          For  one  thing,  files within a library are not available  to  most 
  80.         "normal"  programs.  If  a frequently referenced file is placed in  a 
  81.         library,  it will have to be extracted from the library to its  free-
  82.         standing  counterpart before it can be used by most  programs.  (.COM 
  83.         files are a notable exception to this, because of the availability of 
  84.         the LRUN command, covered later.)
  85.         
  86.          Libraries can actually waste disk space. When a disk file is erased, 
  87.         CP/M  returns  the space formerly used by the file to the free  space 
  88.         pool  for  use by new files.  When a member file is  deleted  from  a 
  89.         library  however,  the  space previously occupied by the file is  not 
  90.         useable. The library must be reorganized to make this space available 
  91.         to  CP/M.  While this is easy to do with the LU program,  it  is  not 
  92.         automatic,  and if the situation is ignored,  large areas of disk can 
  93.         be tied up as unproductive "dead space".
  94.         
  95.                            HOW TO USE THE LIBRARY UTILITY
  96.         
  97.          LU  has two main methods of operation:  interactive,  and  parameter 
  98.         driven.  In  parameter  driven mode,  the program takes  its  command 
  99.         inputs  from the command line when it is first invoked,  and when the 
  100.         entire line has been processed, execution ends.
  101.         
  102.          In interactive mode,  the program takes its command inputs from  one 
  103.         or  more  input lines from the standard input device  (typically  the 
  104.         console).  When all the command inputs have been processed,  the pro-
  105.         gram  reads  another line.  This process can be repeated as  long  as 
  106.         necessary.
  107.         
  108.          Input from disk files,  C program "pipes", and the XSUB facility are 
  109.         also  supported for more advanced applications.  Interactive mode  is 
  110.         probably the best way to get to know the program,  because the effect 
  111.         of each action can be immediately seen.
  112.         
  113.          To start an interactive library maintenance session, just type LU on 
  114.         the command line with no parameters after it.
  115.         
  116.          All the methods make use of similar syntax: Each input line, regard-
  117.         less of its source,  is scanned left to right. All alphabetic charac-
  118.         ters  are  converted to upper case.     If the line  contains  any 
  119.         blanks it is separated into multiple individual input strings.  These 
  120.         input  strings  are divided into two  classes:  operators  (sometimes 
  121.         called tags,  or options) and operands. An operator is defined as any 
  122.         two  character  string  where the first character is  a  minus  sign. 
  123.         Operators tell the program what to do.  Valid operators are -a, -b, -
  124.         c, -d, -e, -l -n, -o, -r, -u and -x. Anything else with the same form 
  125.         is an operator too,  but an invalid one. Operands are any other input 
  126.         string.  The most common operand strings are names of files which are 
  127.         to be acted upon by the previous operator,  for instance, added to or 
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.         extracted  from a library file.  These are called filespec  operands, 
  135.         and have the following general form:
  136.         
  137.          [u/][d:][filename][.[ext]]
  138.         
  139.          where u is an optional user area prefix. It is a decimal number from 
  140.         0 to 31,  and if present,  must be followed by a slash (/) character.   
  141.         User  areas greater than 15 should be used with care,  as they cannot 
  142.         be referenced by any of the resident CCP (Console Command  Processor) 
  143.         commands of CP/M, such as USER, TYPE or ERA.
  144.         
  145.           d is an optional drive designator.  It is a single character in the 
  146.         range of A to P, and if present, must be followed by a colon (:).
  147.         
  148.           filename  is a string of 0 to 8 characters,  following the standard 
  149.         CP/M conventions for filenames.
  150.         
  151.           ext is a string of 0 to 3 characters,  following the standard  CP/M 
  152.         naming conventions for filetype extensions.
  153.         
  154.          The period (.) after filename is manditory if ext is specified,  and 
  155.         optional otherwise. The names "xyz" and "xyz." are equivalent.
  156.         
  157.          Ambiguous operands are those which contain the characters "*" or "?" 
  158.         in  the  filename  or extension fields.  Examples of  valid  filespec 
  159.         operands are:
  160.         
  161.          foo.bar
  162.          3/b:test.fil
  163.          3/test.fil
  164.          b:test.*
  165.          test.fil
  166.          test.
  167.          test
  168.          z
  169.          -z.
  170.          comm?nd
  171.          0/
  172.          b:
  173.          5/a:
  174.         
  175.          Note  in the example "-z." the period,  though not required  by  the 
  176.         syntax of a filename,  is essential to prevent the operand from being 
  177.         mistaken as the invalid operator "-z".  What action is taken upon the 
  178.         operand depends upon which operator most recently preceded it.  If no 
  179.         operator  was  entered,  or an invalid one,  or one that  expects  no 
  180.         operands,  the operand will draw an error message, but will otherwise 
  181.         be ignored.
  182.         
  183.          When  running interactively,  LU prompts for the operators and  ope-
  184.         rands.  You can type as many inputs as will fit on the line,  separa-
  185.         ting  them  with  spaces.  The end of an input line  has  no  special 
  186.         significance.  The  most recent operator remains in effect,  and  the 
  187.         next line can begin with additional operands for it.
  188.         
  189.          The prompt displayed for each input line has this form:
  190.         
  191.          -m u/d:>
  192.         
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.          where m is the current operator in effect
  200.           u is the current user number in effect
  201.           d is the current default drive
  202.         
  203.          For example the prompt might be "-E 0/A:>".  This indicates that the 
  204.         -e  operator is in still in effect;  if an operand is entered it will 
  205.         be interpreted as the name of a member file to be Extracted from  the 
  206.         library.  It  also shows that the current user number is 0,  and  the 
  207.         current drive is A:. Any operands which are entered without an expli-
  208.         cit user or drive will use these defaults.  The defaults can be chan-
  209.         ged at any time with the -u operator, discussed below.
  210.         
  211.          When the program first starts up, the prompt begins with "-?", which 
  212.         means  no  operator is currently in effect.  In this case,  the  only 
  213.         valid input is an operator. Any operand will be rejected.
  214.         
  215.                                 SUMMARY OF OPERATORS
  216.         
  217.          In  this discussion,  the "open library" refers to the library  name 
  218.         specified  as the current library by using the -o operator  discussed 
  219.         below.  The  default  name LIBRARY.LBR is used whenever  an  operator 
  220.         needs an open library, but none is currently open.
  221.         
  222.          -a add files to library. -a causes subsequent operands to be treated 
  223.         as  the  names of files to be added to the  open  library.  Ambiguous 
  224.         operands match all disk files which qualify according to normal  CP/M 
  225.         wild-card conventions, except those with a filetype of .LBR. Explicit 
  226.         user  or  drive  specification on an operand causes that to  area  be 
  227.         searched for the file(s) instead of the defaults.
  228.         
  229.          -b Buffer size set. -b reads the subsequent operator as the size (in 
  230.         sectors) to allocate for a disk I/O buffer.  Normally,  this operator 
  231.         need  never  be  used,  since a 64 sector buffer is  assumed  if  not 
  232.         specified. A full discussion of buffer size considerations, and their 
  233.         relation  to disk access speed is beyond the scope of this  document. 
  234.         Generally, a larger buffer will increase the speed of adding, extrac-
  235.         ting and reorganizing,  but this widely variable with different hard-
  236.         ware.  Bear in mind that a large I/O buffer will decrease the size of 
  237.         the largest library directory which can be processed by the  program, 
  238.         since  the  directory buffer competes for system memory with the  I/O 
  239.         buffer.  Conversely,  setting the buffer to a value less than 64 will 
  240.         increase the maximum directory size.  This operator can only be  used 
  241.         at  program startup,  before the first library is open.  Its operands 
  242.         are  not filespec operands,  but simple integer numbers in the  range 
  243.         1...255.
  244.         
  245.          -c close the open library.  If a library has been opened with the -o 
  246.         operator,  or  if the default library LIBRARY.LBR has been opened  by 
  247.         some other operator,  -c causes it to be closed. Otherwise, it has no 
  248.         effect.  Normally this operator need never be entered, since any open 
  249.         library  is  automatically closed at the end of the session  or  when 
  250.         another  one  is opened.  It is provided for situations where  it  is 
  251.         desired  to  change  disk  volumes without  ending  the  LU  program.   
  252.         Before  removing  the disk containing the library file,  it  must  be 
  253.         closed.  After  mounting a new volume,  the -U operator  (see  below) 
  254.         should be used. The -c operator expects no operands.
  255.         
  256.          -d  delete files from library.  -d causes subsequent operands to  be 
  257.         treated as the names of members to be deleted from the open  library. 
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.         Ambiguous  names  match  all members which qualify.  User  and  drive 
  265.         specifications on operands are ignored, since the library members are 
  266.         obviously in whichever area contains the open library.
  267.         
  268.          -e extract files from library.  -e causes subsequent operands to  be 
  269.         treated  as the names of members in the open library to be  extracted 
  270.         to normal free-standing CP/M files. The original copy is not deleted, 
  271.         and remains in the library.
  272.         
  273.          Ambiguous operands extract all members which qualify.  User or drive 
  274.         specifications  on member names cause the output file(s) to be placed 
  275.         in the specified area rather than the default. Any existing file with 
  276.         the  same name will be overwritten unless it is protected  by  having 
  277.         its Read/Only attribute set on.
  278.         
  279.          -l  list  current library map.  -l causes the directory of the  open 
  280.         library to be listed on the console.  The member names are displayed, 
  281.         along  with  their index (starting record within the  library)  their 
  282.         size  in  sectors,  and the internally calculated  CRC  value.  Also, 
  283.         information is displayed about the number of sectors in the  library, 
  284.         and how much space is used and unused (wasted).  The number of active 
  285.         entries  (members)  in the directory is also displayed,  as well  the 
  286.         number deleted, free for future use, and the total number. This helps 
  287.         determine whether the library needs to be re-organized to free unused 
  288.         space and deleted entries.      The operator -l expects no operands, 
  289.         so the next input should be another operator.
  290.         
  291.          -n Name a member. -n causes each subsequent operand to be treated as 
  292.         a request to change the name of a member in the open  library.  Since 
  293.         both  the  new and old names of the member must be given,  a  special 
  294.         double  operand format is used.  It is essentially two filespec  ope-
  295.         rands "glued together" with an equals sign. For example:
  296.         
  297.            newname.typ=oldname.typ
  298.         
  299.          would  cause  the  member OLDNAME.TYP to have its  name  changed  to 
  300.         NEWNAME.TYP.  If the old name is not found in the open library, or if 
  301.         the  new name is that of an existing member,  no rename takes  place, 
  302.         and an appropriate message is displayed.  Operands which do not  con-
  303.         form  to the special <new>=<old> syntax will also draw an error  mes-
  304.         sage.
  305.         
  306.          -o open a library.  -o causes the following operand to be treated as 
  307.         the  name  of  a library file to be opened for  use  with  subsequent 
  308.         operators.  If there is already an open library,  it is first closed, 
  309.         and  the  new one opened.  If the new library does not exist,  it  is 
  310.         created with no members.  Ambiguous names are not allowed.  User  and 
  311.         drive  specification  can be used to override the current  area.  The 
  312.         file  type may be specified,  but if not entered,  defaults  to  .LBR 
  313.         which  is strongly suggested as the file type for all library  files. 
  314.         You  will recall that files of type .LBR are ignored by the  wildcard 
  315.         matching of the -a (add) operator.      This prevents libraries from 
  316.         being  accidentally  added to other libraries,  or to  themselves;  a 
  317.         situation not unlike trying to drive a truck up its own tailpipe.  If 
  318.         for some reason you want to add one library to another,  be my guest, 
  319.         but you will have to specify the name without * or ?  characters when 
  320.         adding it.
  321.         
  322.          -r  reorganize library.  -r causes the currently open library to  be 
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.         reorganized.  First, the directory is sorted into alphabetical order, 
  330.         and  then  all active members are copied to a work library  which  is 
  331.         opened  on the default user/drive.  The size of the directory may  be 
  332.         changed  at this point by specifying a greater or smaller  number  of 
  333.         entries than were present the old library.  The directory will always 
  334.         be  made  large enough to contain all the active members of  the  old 
  335.         library,  so  it is safe to enter a size of "1" to make the directory 
  336.         as small as possible. (See Specifying Directory Sizes below.)
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.          When reorganization is complete, the old library is deleted from its 
  344.         user/drive area,  and the work library in the default area is renamed 
  345.         to the name of the old library. No backup copy is retained. The newly 
  346.         reorganized library remains open for use with subsequent  operations. 
  347.         Note  that  although the newly reorganized library always ends up  in 
  348.         the default area,  the default area can be changed with the -u opera-
  349.         tor.  (Do this first,  before using -o.) Also, the old library can be 
  350.         opened in any area,  by using explicit user/drive specifications. The 
  351.         net  result is that it is possible to reorganize a library  from  any 
  352.         desired area to any other area. Reorganizing a library to a different 
  353.         drive  is  usually a much faster operation,  and is manditory if  the 
  354.         current disk does not contain enough free space for the old and  work 
  355.         libraries at the same time.
  356.         
  357.          -u  Use new default area.  The -u can be used to change the  default 
  358.         value  for user number or drive.  It causes the user prefix and drive 
  359.         spec of the following operand to be used as the new default area.  If 
  360.         the  following  operand has no user prefix,  or no  drive  spec,  the 
  361.         corresponding default is not changed.  (The filename and ext sections 
  362.         of the operand must be absent.) If a change is made, any open library 
  363.         is first closed,  and the disk system is reset.  Thus feature  allows 
  364.         newly mounted disk volumes to be referenced for writing;  CP/M causes 
  365.         new  volumes to be Read Only until the program performs a disk system 
  366.         reset.  The -u operator also affects which area will be used for  the 
  367.         work library during reorganization.  See the -r operator above. Note: 
  368.         If directed I/O is active (See advanced features below) the -u opera-
  369.         tor is treated as invalid. Due to some unfortunate assumptions in the 
  370.         C run-time package,  the default drive cannot be safely changed while 
  371.         directed  I/O files are open,  and the BDOS gets confused by the disk 
  372.         reset under these conditions.
  373.         
  374.          -x  eXit program.  -x causes the interactive mode to be turned  off, 
  375.         which  means that the input line containing it will be the last  line 
  376.         scanned by the program.  It does not cause immediate program termina-
  377.         tion, and if any more operators follow it on the same line, they will 
  378.         be processed normally.  The program terminates only after the current 
  379.         line  is fully processed.  Any open library is then closed,  and  the 
  380.         user  number and default drive are reset to the values they had  when 
  381.         the  program was originally invoked.  To preserve compatibility  with 
  382.         earlier  versions,  the program will also end if an empty input  line 
  383.         (carriage return alone) is typed.
  384.         
  385.                               SPECIFYING DIRECTORY SIZE
  386.         
  387.          Whenever an old library is opened,  the directory size is  displayed 
  388.         as follows:
  389.         
  390.          Old library LIBRARY.LBR has 32 entries, 5 free.
  391.         
  392.          This  means  that 5 more members may be added before  the  directory 
  393.         becomes  full.  When  the directory is full,  -a becomes  an  invalid 
  394.         operator,  and  the library must be reorganized to add any more  mem-
  395.         bers.  When  a  library is created for the first time,  the  user  is 
  396.         prompted like this:
  397.         
  398.          New library COMMAND.LBR.  Allow how many entries?_
  399.         
  400.          Any  number from 1 to 65535 is valid.  The actual maximum is  deter-
  401.         mined  by  the amount of free memory available on the system in  use. 
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.         Directory size will be rounded up to the next whole sector  necessary 
  409.         to  contain the number of entries requested.  This number will remain 
  410.         in  effect  until the library is  reorganized.  Since  the  directory 
  411.         itself counts as an entry, one entry is added to your response before 
  412.         the  size is calculated.  Therefore just enter the maximum number  of 
  413.         member files you want the library to be capable of holding.
  414.         
  415.          The maximum number of member files is also constrained by the amount 
  416.         of  available disk space.  If the disk space runs out during an  add, 
  417.         the  name  is  not added to the directory.  If a multiple add  is  in 
  418.         progress, due to an ambiguous operand, the remaining qualifying files 
  419.         are still added if possible. If any of them is small enough to fit in 
  420.         the  remaining  disk space,  it will be added.  If any  sectors  were 
  421.         written by a failed add attempt, and then never utilized, they remain 
  422.         as unused sectors, and the library should be reorganized.
  423.         
  424.                                PARAMETER DRIVEN METHOD
  425.         
  426.          All of the information needed for a maintenance run may be specified 
  427.         on the command line.  The operators and operands are  entered,  sepa-
  428.         rated by spaces,  after the LU command,  and the operations will take 
  429.         place  without  console intervention,  except in the case  where  the 
  430.         directory size for a new library is requested. The syntax is:
  431.         
  432.          LU <opr> [<opd> [<opd> ...]] [<opr> [<opd> ...]...
  433.         
  434.          where square brackets indicate optional parameters, and:
  435.          <opr> is any operator.
  436.          <opd> is any operand.
  437.          ...  indicates that the preceding parameter may occur multiple times.
  438.          Any  names  occurring prior to the first operator,  or following  an 
  439.         operator which does not expect operands, are ignored.
  440.         
  441.                                     CRC CHECKING
  442.         
  443.          Whenever a new member is added to a library,  a value called the CRC 
  444.         (Cyclic  Redundancy Check) word is calculated and stored in the  mem-
  445.         ber's directory entry.  When the member is extracted from the libra-
  446.         ry, the calculation is done again, and compared with the saved value. 
  447.         If the two values do not match,  it is an indication that the  member 
  448.         was damaged in some way while it was in the library. The extract will 
  449.         still be performed,  but a message warning that the extracted copy is 
  450.         questionable will be displayed.
  451.         
  452.          This  feature  is especially valuable for libraries which have  been 
  453.         created on another system and transmitted by phone (possibly  several 
  454.         times)  before you receive them.  It helps insure that the  extracted 
  455.         files  are  faithful reproductions of the files  originally  inserted 
  456.         before  transmission.  Members added by LU versions prior to 2.20  do 
  457.         not have CRC words.  The CRC check will be bypassed when one of these 
  458.         is  extracted.  The CRC word of the directory itself is checked  when 
  459.         the  library  is  opened.  A message warning of a CRC error  will  be 
  460.         displayed  at that time.  Libraries modified by LU versions prior  to 
  461.         2.20  have no directory CRC word,  and the CRC check will usually  be 
  462.         bypassed.  If  a  warning does occur,  it will not  adversely  affect 
  463.         operation.  When a library is reorganized, CRC words will be added to 
  464.         all members,  if not present. CRC errors which occur during reorgani-
  465.         zation  will cause the program to abort.  The damaged member must  be 
  466.         deleted before the library can be reorganized.  Libraries created  by 
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.         this  version  of LU can be read by all previous  versions.  The  CRC 
  474.         values  inserted  will  simply be ignored by early  versions  of  the 
  475.         program.
  476.         
  477.                                   ADVANCED FEATURES
  478.         
  479.          Input from BDS C "pipes" or ordinary sequential files is also possi-
  480.         ble.  The filename is specified on the command line preceded by a "<" 
  481.         character and no intervening blank. Example:
  482.         
  483.          LU <CONSOL.DUP
  484.         
  485.          reads  the contents of the file CONSOL.DUP and uses each line of the 
  486.         file as if it had been typed at the normal console by the interactive 
  487.         method.  In this case, no operators or operands may be present. Con-
  488.         sole  output may also be redirected by specifying an output  file  on 
  489.         the  command line after the character ">".  This applies to parameter 
  490.         driven as well as interactive (including "piped") input. Examples:
  491.         
  492.          LU -O 3/SPECIAL -A B:ZOT.COM >20/C:LOGFILE.OUT
  493.         
  494.          would add the file zot.com from drive b,  current user area,  to the 
  495.         library  special.lbr,  in user area 3 on the default  drive.  Console 
  496.         output would be written to a file called logfile.out in user area  20 
  497.         on  drive  c.  The placement of the output name on the line does  not 
  498.         matter and except for turning on redirected output,  it is ignored by 
  499.         all operators.
  500.         
  501.          LU <BATCH.IN >B:RECORD.DOC
  502.         
  503.          would  take  interactive commands from the file batch.in  and  write 
  504.         console output to a file called record.doc on drive B.
  505.         
  506.          Normally,  console  file output is also echoed on the real  console, 
  507.         except  when input is also redirected,  as in the  last  example.  To 
  508.         force  visible console output when both an input and output file  are 
  509.         used, the ">" character preceding the output file name may be changed 
  510.         to a "+" like this:
  511.         
  512.          LU +RECORD.DOC <BATCH.IN
  513.         
  514.          This would have the same effect as the previous example, except that 
  515.         message output would also be visible on the console.
  516.         
  517.                                       CAUTIONS
  518.         
  519.          The  importance  of  keeping backup copies of all  disk  files,  and 
  520.         especially  libraries,  cannot be overemphasized.  By  using  library 
  521.         files,  the user is exposed to the dreaded all-the-eggs-in-one-basket 
  522.         syndrome. That is, if something happens to the library file, particu-
  523.         larly the directory, it may be beyond the capabilities of even a CP/M 
  524.         wizard to restore the member files. The situation is made particular-
  525.         ly sticky by the fact that the the directory must be updated in place 
  526.         as members are added or deleted.
  527.         
  528.          Precautions  have been taken to minimize this risk.  For one  thing, 
  529.         the  directory is read into memory when the library is first  opened, 
  530.         and  is  only written back if it differs from the copy on  the  disk. 
  531.         Operations  which change the directory are:  adds,  deletes,  and the 
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.         sort operation which is done before reorganization.  If only extracts 
  539.         (or LRUN executions) are done,  the directory is never rewritten, and 
  540.         the  .LBR file may be write protected if desired,  by using the  CP/M 
  541.         STAT  command.  When a read-only library is open,  all  LU  operators 
  542.         except  -l,  -b,  and -e become invalid.  As another precaution,  the 
  543.         entire  empty directory is allocated and written to disk when  a  new 
  544.         library  is  first created.  This insures that there will  always  be 
  545.         enough space on disk for the number of directory entries requested at 
  546.         the time of creation.  The disk space may run out while adding member 
  547.         files,  but  there  will always be enough room on disk to update  the 
  548.         directory  once it is successfully created.  The fact that  only  the 
  549.         memory copy of the directory is modified until the file is closed may 
  550.         come  in very handy if you mistakenly delete a member file and recog-
  551.         nize  it right away.  For example,  suppose you make the  mistake  of 
  552.         typing "-d *.*".  Briefly,  your heart sinks, as the "Deleting:" mes-
  553.         sages are displayed and all the member names zip into oblivion. Don't 
  554.         panic.  Only the memory copy of the directory has been modified. When 
  555.         the -D 0/A:> prompt returns,  do not hit RETURN.  Instead,  abort the 
  556.         program with Control-C. This will cancel the program without updating 
  557.         the directory,  and the original members will still be present. Here 
  558.         is another caution. Since the entire directory must fit in memory for 
  559.         a  library  to  be successfully opened,  it is possible that  a  huge 
  560.         directory created on a your system will be too large to fit in memory 
  561.         if  read  on another system will less memory.  This should not  be  a 
  562.         problem  with a library of under a hundred entries.  To give  you  an 
  563.         idea  of  how much elbowroom you have to work with,  LU displays  the 
  564.         highest memory location used each time it terminates.  This will vary 
  565.         depending on the size of the disk I/O buffer,  as well as the largest 
  566.         directory  used  during  operation,  and will be slightly  higher  if 
  567.         interactive operation was used,  since a console buffer must be allo-
  568.         cated.  It  does not include the stack,  which grows down  from  high 
  569.         memory, and is allowed about a thousand bytes of space for subroutine 
  570.         parameters and temporary work areas.
  571.         
  572.                                   THE LRUN COMMAND
  573.         
  574.          The  LRUN  command  was  created for those of us who  have  lots  of 
  575.         command files we like to keep on line all the time.  We all have some 
  576.         favorite little .COM files are very small programs,  but having a lot 
  577.         of  them  on disk eats up file space at an alarming rate due  to  the 
  578.         fixed CP/M block size. Put them all into a library called COMMAND.LBR 
  579.         using  LU.      You  can then run any .COM file directly  from  the 
  580.         library by saying:
  581.         
  582.          LRUN <followed by normal command line just like always>
  583.          The full syntax of LRUN is:
  584.         
  585.          LRUN [-<lbrfile>] <commember> [<parameters>]
  586.          Where:
  587.         
  588.          <lbrfile> is the library to be searched.  The square brackets around 
  589.         -<lbrfile> indicate it is optional.  The - character tells LRUN  that 
  590.         what follows is a library name. It is not an actual part of the name. 
  591.         Don't leave a space after the -. If the first parameter doesn't begin 
  592.         with - then the default library COMMAND.LBR is used.  If a drive spec 
  593.         is  given,  such  as  B:,  then only that drive is searched  for  the 
  594.         library.  If  no drive spec is given,  the current area  is  searched 
  595.         first,  and if no library of that name is found,  the default area is 
  596.         searched  before giving up.     The default area is set to 0/A:  in 
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.         the  distribution object code,  but this can be changed to  something 
  604.         more  appropriate  for  your system by changing two  equates  in  the 
  605.         source program and reassembling. LRUN does not otherwise support user 
  606.         numbers, and will not recognize the "u/" syntax on its parameters. If 
  607.         a name, but no type is entered, .LBR is assumed.
  608.         
  609.          <commember> is the name of the command to be run.  No drive spec  is 
  610.         used here. The type defaults to .COM and need not be entered.
  611.         
  612.          <parameters>  is  a the normal (possibly empty) list  of  parameters 
  613.         which  the  .COM file expects to find on the command line when it  is 
  614.         run.  This  list  is parsed to the required file control  blocks  and 
  615.         command line area before execution begins, so the program will not be 
  616.         aware  that  anything cute is going on.  (Thanks to  Ron  Fowler  for 
  617.         supplying the code which makes this possible.)
  618.         
  619.                                     LRUN EXAMPLES
  620.         
  621.          LRUN ED FOO.BAR
  622.         
  623.          the file ED.COM is searched for in COMMAND.LBR on the current drive, 
  624.         or the A:  drive.  If found,  ED.COM is loaded from the library,  and 
  625.         FOO.BAR is passed to it as a parameter. LRUN -C:SPECIAL LU -O COMMAND 
  626.         -A  A:*.COM  the file LU.COM is searched for in SPECIAL.LBR on the  C 
  627.         drive.  If found,  LU.COM is loaded, and the strings -O, COMMAND, -A, 
  628.         and *.COM are passed to it as parameters.
  629.         
  630.          LRUN - -ZIP
  631.         
  632.          the  file  -ZIP.COM is searched for in COMMAND.LBR  on  the  current 
  633.         drive,  or the A:  drive.  If found,  -ZIP.COM is loaded and executed 
  634.         with  a  blank parameter list.  Since -ZIP.COM begins with a  -,  the 
  635.         extra  - followed by a space was needed to act as a place-holder  for 
  636.         the library name. Compare with:
  637.         
  638.          LRUN -ZIP
  639.         
  640.          the library -ZIP.LBR is looked for,  but nothing else  happens,  be-
  641.         cause no command was specified.
  642.         
  643.          LRUN
  644.         
  645.          with no parameters at all, causes a screen of help information to be 
  646.         displayed as a memory refresher.
  647.         
  648.          Please  report any problems or suggestions for enhancement to me via 
  649.         CompuServe  CP-MIG or EMAIL,  user number 70160,120;  or by phone  at 
  650.         (201) 935-4087, voice, evenings (eastern time) or weekends.
  651.         
  652.            Gary P.  Novosielski
  653.  
  654.  
  655.  
  656.