home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / ZCPR33 / A-R / LOADND12.LBR / LOADND.DZC / LOADND.DOC
Text File  |  2000-06-30  |  17KB  |  382 lines

  1. Program: LOADND
  2.      Logs in a disk and updates the ZCPR3 system Named Directory
  3. (NDR) to reflect the directory names (if any) for the target disk.
  4.  
  5. LOADND is copyright by A. E. Hawley January 30, 1987.
  6. It may be freely distributed, but it must not be sold 
  7. either separately or as part of a package without the 
  8. written consent of the author.  The author may be reached 
  9. via electronic mail at the Ladera Z-Node in Los Angeles,
  10. 213-670-9465, or through the Lillipute Z-Node in Chicago 
  11. at 312-649-1730.
  12.  
  13. LOADND is released for beta test through the Z-system 
  14. users group Z-SIG on January 30, 1987 by the author.
  15.  
  16. Author: Al Hawley, Ladera Z-Node, (213) 670-9465
  17.  
  18. VERSION HISTORY:
  19.  
  20. 1.2 - 01/31/87 - by AEH
  21.     Added error and progress reporting routines. The progress
  22.     reporting messages respond to the ZCPR3 Quiet command.
  23.     (A computer, like a wife, should not chatter about things
  24.     that you're not interested in!)
  25.     The HELP screen reflects current choice of key command
  26.     letter options, which are user definable by setting the
  27.     value of those parameters in a data area.
  28.     Parameters which can be changed to customize the program
  29.     were moved to a data area near the start and marked with
  30.     ascii labels that show up with ZDM or other debuggers.
  31.     For most customization, it is not necessary to reassemble
  32.     the program - just use the debugger to make changes to
  33.     the byte(s) following the markers. See CUSTOMIZATION, below.
  34.     
  35. 1.1 - 01/25/87 - BY AEH 
  36.     Name Change only. Change from DSKNDR to LOADND to better
  37.     reflect the program function and relation to other programs
  38.     which perform operations on the system NDR. The other
  39.     programs are EDITND (V1.0, Jan87) and SAVEND (to be released
  40.     in Feb87). EDITND edits the resident Named Directory buffer;
  41.     SAVEND copies the resident Named Directory buffer to a disk
  42.     file suitable for reloading with LDR.COM.
  43.  
  44. 1.1 - 12/26/86 - by AEH - 
  45.     Replaced the first routine in INIT: which tests for
  46.     valid Z3ENV definition. The original routine tested
  47.     for a zero address (inadequate). The new routine tests
  48.     for equality of the 'Z3ENV' strings which occur at the
  49.     beginning of a ZCPR3 utility and the environment
  50.     descriptor. If they don't match, installation is required.
  51.  
  52. 1.0 - 12/17/86 - Initial version.
  53.  
  54. Previous similar pgm: LDSK 1.1 by Wilson Bent
  55.  
  56. PROGRAM FUNCTION:
  57.      Logs in a disk and updates the ZCPR3 system Named Directory
  58. (NDR) to reflect the directory names (if any) for the target disk.
  59. New Directory Names for the target drive are obtained from one of
  60. two sources. The first source is an existing file on the target
  61. disk. The name of that file is specified in the abbreviated FCB
  62. labeled 'ndrfls:'. The default file specification is *.NDR. 
  63. The second source is (as in LDSK) the list of filenames
  64. specified in the FCB labeled 'dashfn:'. The current default
  65. specification is '-*.*', i.e. those filenames whose first
  66. character is a '-' character.
  67.  
  68.  
  69. WHY IS IT NEEDED?
  70.      In a ZCPR3 system, Named Directories can be used instead of
  71. or in addition to the Disk/user form of specifying user areas
  72. in the systems mass storage. Directory names are stored in a
  73. system buffer from a file whose type is .NDR. The buffer is
  74. usually loaded at cold boot time along with other initialization
  75. procedures. Subsequently, a new set of names (contained in another
  76. .NDR type file) can be loaded by invoking LDR.COM. New NDR files
  77. can be created (or old ones modified) through use of the MKDIR
  78. utility. Although this is an efficient and useful system, there
  79. arises a problem which many users have recognized: 
  80.  
  81.      Suppose you have a system with 2 floppy drives, A and B. The
  82. NDR file contains names for BOTH drives. If you switch disks in
  83. one of the drives, you may need a new set of directory names. So
  84. you can make another NDR file and load it. However, the number of
  85. combinations (=number of NDR files!) becomes quite large if you
  86. have very many different types of application disks! What is needed
  87. is a method of dynamically changing the entries in the system NDR
  88. buffer for just one drive. The new names for THAT drive should come
  89. from file(s) on the new disk.
  90.  
  91. UPDATE FROM AN *.NDR FILE
  92.      Most of my floppy disks are bootable; they contain Z-system on
  93. the system tracks, and the required system modules on the data tracks.
  94. The SYS.NDR file presumes the disk is in drive A (the boot drive), and
  95. the directory names for drive A are appropriate for that disk. Those
  96. entries are what one would want in the system NDR (with the appropriate
  97. drive designator) when that disk is inserted in some other drive. So I
  98. started the LOADND program with the purpose of solving the problem
  99. described above by installing the (drive A) entries from the NDR file
  100. on the disk in the system NDR buffer. During the installation, the
  101. 'A' is changed to the letter appropriate to the drive which contains
  102. the disk.
  103.  
  104. UPDATE FROM DASHFILES
  105.      There is another method of designating directory names; an unique
  106. character is used as the first byte of a filename in each directory.
  107. That filename (without the first character and ignoring the type field)
  108. is then taken as the directory name. If a '-' is the first character,
  109. then the name appears near the top of a sorted directory listing. Such
  110. files are called 'dashfiles'. In this documentation, the term is used
  111. even when some other character (like '!', for instance) is the first
  112. character. Wilson Bent, Jr. seized on these names as a method of
  113. solving the NDR problem; his well-executed program, LDSK, searches
  114. the target disk for dashfiles and uses them to update the system NDR.
  115.  
  116. CREDIT:
  117.      LDSK came to my attention after I had already designed LOADND for
  118. accessing NDR files on a target disk. LOADND owes much to Wilson Bent
  119. for many of his ideas which were incorporated for handling dashfiles.
  120. Because of differences in program flow and data structuring, it was
  121. easier for me to incorporate his good work into LOADND than to make a
  122. revision to LDSK. 
  123.  
  124. CUSTOMIZATION
  125.  
  126.      At (approximately) location 010Ch in LOADND.COM there are some
  127. user-settable parameters. Each is preceded by a label whose last
  128. character is '>'. The byte(s) immediately following the '>' are the
  129. parameters which may be changed (a debugger can be used). 
  130.     label:    byte(s)        notes:
  131.     DIRLTR>    -        The first char of files used to
  132.                 identify a user area. '-',usually
  133.     NDROPT>    N        The option letter used to specify
  134.                 getting names from an .NDR type file
  135.     KEEP>    A        Only names for drive 'A' in the NDR
  136.                 file will be used for the update. This
  137.                 is usually appropriate. Change it if
  138.                 your situation is different. THIS IS
  139.                 NOT THE SAME AS THE TARGET DRIVE IN
  140.                 THE COMMAND LINE!
  141.  
  142.      NDRFILE>    0????????NDR    Prototype fcb for finding NDR files
  143.     DASHFILE>    0-??????????    Prototype fcb for selecting marked files
  144.  
  145. The last two are the first 12 bytes of data for an fcb. Don't change
  146. the leading '0'! The '?' characters can be changed to anything you
  147. wish in order to restrict the filenames/types searched for on the
  148. target disk. The '-' is not actually used; that letter is filled in
  149. by the program from the value at DIRLTR>.
  150.  
  151.  
  152. HIGHLIGHTS of LOADND
  153.  
  154. 1)    LOADND is a ZCPR3 utility. Standard structure, command
  155.     syntax, and HELP functions are provided. The HELP function
  156.     describes command syntax using the ACTUAL name of the
  157.     program (in case you have renamed it!), and also
  158.     shows the defaults for arguments; the default for the
  159.     drive is always displayed as the currently logged drive.
  160.     Since modification of system facilities is dangerous in
  161.     general, the wheel byte is checked and non-privileged
  162.     users are denied the use of LOADND.
  163.  
  164. 2)    Either dash-files, or an .NDR (or other) file
  165.     can be used to specify the new directory names. The
  166.     choice of which to use (or which to try first if both
  167.     types are used) is determined by a byte near the
  168.     beginning of the program. This default choice can be
  169.     modified with a debugger, by reassembly, or by an
  170.     option on the invoking command line.
  171.  
  172. 3)    Complete restructuring of the code permits flexibility
  173.     in making changes (improvements?)
  174.  
  175. 4)    Because of the use of dynamically assigned buffers,
  176.     LOADND permits the processing of system Named Directory
  177.     Buffers of any size.
  178.  
  179.  
  180. LOADND command line syntax:
  181.  
  182.     LOADND [<drive letter>[:]] [/<option letters>]
  183.  
  184. <drive letter> is the drive whose named directory entries in
  185.     the system NDR buffer are to be replaced with new entries
  186.     specified from information on that drive. If this argument
  187.     is not present, the system default drive is assumed.
  188.     The drive used is called the 'target drive' in the LOADND
  189.     source code. Note that the ':' is optional. In fact, any
  190.     number (limited by the size of the ZCPR3 command buffer)
  191.     of characters may be present; all but the first are
  192.     ignored.
  193.  
  194. <option letters> 
  195.     Two letters comprise valid options: N, and D. (also n, d)
  196.     The option field must start with a '/' and must not contain
  197.     spaces or commas. At least one space or comma must be used to
  198.     separate the option field from the preceding portion of
  199.     the command. The options define the source of directory
  200.     names on the target disk. 'N' specifies an .NDR-type file;
  201.     'D' specifies the set of dashfiles. If BOTH are specified,
  202.     the second option is used only if the first failed to
  203.     find appropriate files. (i.e. /ND means 'use an NDR file. If
  204.     no NDR file is found, then look for dashfiles to use.')
  205.  
  206. Defaults exist for both of the arguments: The Current Drive for
  207.     the first, and an option built-in at assembly time for
  208.     the option(s). When HELP is invoked, the current defaults
  209.     are reported.
  210.  
  211. Invalid entries for either argument will result in display of the
  212.     Help Screen. In particular, the following commands get help:
  213.  
  214.         LOADND ?
  215.         LOADND //
  216.         LOADND B: ?
  217.         LOADND H
  218.  
  219.  
  220. LOADND dynamically allocates four BUFFERS during its operation. They are:
  221.  
  222. BUFFER 0 - referred to as 'lclndr' , 'NDBuff', and 'new NDR'
  223.     This buffer contains the Named Directory entries as they are
  224.     collected from the system NDR and one of the sources on the
  225.     target disk. The system NDR buffer is finally overlayed by
  226.     the contents of this buffer.
  227.  
  228. BUFFER 1 - contains names from the target disk directory like *.NDR
  229.  
  230. BUFFER 2 - contains names from the target disk directory like -*.*
  231.  
  232. BUFFER 3 - The contents of the .NDR file selected from buffer 1 are
  233.     read into this buffer. The data in this buffer is in exactly
  234.     the same format as the system (and buffer 0) NDR buffer.
  235.  
  236. Buffer Control Blocks (BCBs) are used to allocate memory space for
  237.     and access the four buffers. They are named BCB0, BCB1, BCB2,
  238.     and BCB3. The BCBs are in the data area near the end of the
  239.     LOADND pgm. They are filled in by the program code as required
  240.     by the quantity and nature of the data being stored in each
  241.     buffer.
  242.  
  243. PROGRAM FLOW
  244.     The main sequence of events is straight-forward and can be
  245.     easily seen in the MAIN: routine at the beginning of the
  246.     program. BOTH .ndr and dash- filenames are extracted from
  247.     the target disk using the DIRF function from SYSLIB. The
  248.     disk directory names returned by DIRF are sorted in ASCII
  249.     ascending order. If there is more than one .NDR-type file
  250.     found, the first one is used; this is thus the alphabetically
  251.     first .ndr file on the disk regardless of user area it is
  252.     from.
  253.  
  254.     The CASE routine determines from the default or command
  255.     line option(s) which routines to use for loading Directory
  256.     names into the local copy of the System Named Directory
  257.     buffer (NDR). When the number of names to be added excedes
  258.     the capacity of the buffer, those which would cause the
  259.     buffer to overflow are ignored. If the option chosen is to
  260.     use both types of source, then the following algorithm is
  261.     used:
  262.     An attempt is made to use the first-named source (N or D)
  263.     for new directory names. If no names are found, then the
  264.     second source is used. If neither source is present, then
  265.     the Named Directory Buffer is rewritten to the System
  266.     with the Directory Names for the target drive DELETED.
  267.  
  268.     For example, when the option is /ND,
  269.     If at least one .NDR type file was found, then its contents
  270.     are loaded into buffer 3 and used to append to the data in
  271.     buffer 0 (lclndr). Only the names associated with Drive A
  272.     in the NDR file are used, and their associated password
  273.     fields are included.
  274.     If no .NDR file was found on the disk, or if the one found
  275.     contained no entries for the target disk, then the dashfiles
  276.     (if any) in buffer 2 are reformatted (a blank password field
  277.     is added) and appended to buffer 0.
  278.  
  279. NOTES:
  280.  
  281. 1)    I have attempted to use a highly structured approach in the
  282.     coding. As a result, you will observe that some of the data
  283.     in (for example) the BCB's is never referenced. 'Extra' 
  284.     instructions like unnecessary pushes & pops will be observed
  285.     in many routines. 'Optimization' by removing such code is
  286.     undesireable, since its purpose is to make the routines fairly
  287.     free-standing. Economizing on instructions will not have a
  288.     noticeable effect on program speed, since the several disk
  289.     accesses use more time than anything else.
  290.  
  291. 2)    The 'wrapup' routine is stubbed in for the eventuality that
  292.     a restoration to the original D/U, for example, might be
  293.     required before return to the OS.
  294.  
  295. 3)    If neither an .NDR file or dash-file(s) are found, the result
  296.     will be an absence of Named Directories for the target disk.
  297.     Should the program in such a case simply abort without
  298.     changing the system NDR ? Should the choice be a command line
  299.     option? ..an assembly time option?
  300.  
  301. 4)    Should the error flag be set when the program runs into trouble
  302.     such as in (3) ?
  303.  
  304. 5)    With few exceptions, subroutines return with logic TRUE
  305.     or FALSE (and zero flag adjusted) to reflect potential
  306.     problems. Deletion of such code in the interest of 'cleanup'
  307.     should be done with caution!
  308.  
  309. 6)    LDISK reports the new directory names as they are entered
  310.     into the LCLNDR buffer. LOADND does not. Should it? Or, as an
  311.     alternative, should LOADND chain to PWD for a display? (That's
  312.     fairly easy to do with Z3LIB routines.)
  313.  
  314. 7)    Neither LDSK nor LOADND checks newly added directory names to
  315.     see if they duplicate existing ones. I plan to add such a
  316.     test. What should happen when an attempt to add a duplicate
  317.     is detected? - Modify the new name algorithmically? (what
  318.     algorithm? ) - Delete the offending name? (which one?) -
  319.     Should the user be asked to choose a new name?
  320.  
  321. 8)    No provision is made for an internal ZCPR3 Environment. I
  322.     couldn't think of a reason for using it. Should it be
  323.     provided for?
  324.  
  325. 9)    There are no actual FCB's in the program. Those structures
  326.     labeled to resemble FCB's are simply the first 12 bytes of
  327.     an FCB. Where an actual FCB is required, the system FCB at
  328.     5Ch is used.
  329.  
  330. 10)    If you examine (with a debugger) the memory allocation as
  331.     shown by the values in the BCB's after a target NDR file
  332.     has been loaded, you will see that 'holes' exist. It didn't
  333.     seem worth the trouble to pack the buffers to recover space
  334.     no longer used (by DIRF, mainly). A final refinement, maybe?
  335.  
  336. 11)    LDSK 2.0 contains several enhancements, one of which is the
  337.     option to have a list of drives to log-in on the command
  338.     line. Since ZCPR3 provides for multiple commands on one
  339.     line, I felt that this was unnecessary in LOADND; further,
  340.     with the option field provided in this program it might be
  341.     an avantage to permit a choice of options for each drive
  342.     logged.
  343.  
  344. 12)    I saw no scenario in which the error flag should be set.
  345.     Is there a need for an error indication?
  346.  
  347. PLEASE SEND COMMENTS TO:        Al Hawley
  348.                     Ladera Z-node, Los Angeles
  349.                     213/670-9465
  350.  
  351. (Selected) Notes from LDSK 1.1, by:
  352.     Wilson H. Bent, Jr.
  353.     39 Maple Ave.
  354.     Fair Haven, NJ  07701
  355.     Work: (201) 949-1277
  356.     UN*X: ... ihnp4!vax135!hoh-2!whb
  357.     RCP/M: Lillipute: (312) 649-1730 Chicago
  358.            Voorhees:  (609) 428-8864 So. NJ
  359.  
  360. LDSK logs in disk directories as follows:
  361.   First the Named Directory Buffer is copied,
  362. clearing entries for the current disk.  Then
  363. the disk is searched for files of the form:
  364.     -???????.???
  365. (i.e, an initial dash), which are assumed to
  366. be names of directories.  Using these, a new
  367. NDBuff is built, which replaces the old one.
  368. Note that the extent of the file is ignored.
  369.  
  370. NDBuff entries are:
  371.    Disk: 1 byte (A = 1, B = 2, M = 0Dh)
  372.    User: 1 byte
  373.    Name: 8 bytes (space-filled)
  374.    Pass: 8 bytes (ditto)
  375. The password entry is optional, and cleared to spaces.
  376.  
  377. Lower-case names are allowed, but how're y'gonna make
  378. a file with'em? (answer: with some editors, or DU.COM - aeh)
  379.  
  380. The number of names is limited to 14.
  381.  
  382.