


      RRRReeeeaaaaddddDDDDiiiirrrreeeeccccttttoooorrrryyyy((((3333BBBB))))            ((((RRRRiiiiddddggggeeee))))            RRRReeeeaaaaddddDDDDiiiirrrreeeeccccttttoooorrrryyyy((((3333BBBB))))



      NNNNAAAAMMMMEEEE
           ReadDirectory - read the contents of a directory

      SSSSYYYYNNNNTTTTAAAAXXXX
           FUNCTION ReadDirectory (name : String;
                                   firstRequest : Boolean;
                                   dirPage : PDirectoryPage;
                               var numEntries : Integer;
                               var anyMore : Boolean) : Error;

      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
           ReadDirectory is used to read the contents of a directory.
           The directory contents are returned in a standard format,
           which contains entries that map a name to an internal file
           identifier, or indicate that an entry is the name of a
           subdirectory.

           Each call to ReadDirectory returns only one 4096-byte page
           of information.  The entries are returned in alphabetical
           order so that multiple requests can be made, each time
           specifying a different place in the alphabetical list to
           start returning more entries.  The parameters "firstRequest"
           and "anyMore" are used as described below to make multiple
           requests, thus enabling a large directory to be read.

           The first call to ReadDirectory for a directory whose
           pathname is "name" should have the parameter "firstRequest"
           set to True.  The number of valid entries for the returned
           directory page is returned in "numEntries".  If more
           information exists in the directory than can be returned in
           a single response, then the parameter "anyMore" will be set
           to True upon return, otherwise "anyMore" will be set to
           False.

           If "anyMore" is True, then another call to ReadDirectory
           should be made with "firstRequest" set to False.  The
           parameter "name" should be extended to include the directory
           name and the name of the last entry returned, separated by a
           "/".  The returned information will start with the next
           alphabetical entry.

           ReadDirectory places a block of directory information into
           the data area specified by "dirPage" in the following
           format:

           PDirectoryPage = ^ DirectoryPage;
           DirectoryPage  = Array [0..127] of DirectoryEntry;
           DirectoryEntry = Record
                              name  : Array [1..16] of Char;
                              fType : Integer;
                              fID   : FileID;
                            end;



      Page 1                                                   (9010-E)






      RRRReeeeaaaaddddDDDDiiiirrrreeeeccccttttoooorrrryyyy((((3333BBBB))))            ((((RRRRiiiiddddggggeeee))))            RRRReeeeaaaaddddDDDDiiiirrrreeeeccccttttoooorrrryyyy((((3333BBBB))))



           The page may contain up to 128 entries, starting with entry
           number zero.  Each entry has a "name" field, which is 1 to
           16 characters with blanks filled at the end.  The "fType"
           field has the value 1 if the entry is a regular file, and
           the "fID" field contains an internal file identifier in this
           case.

           The "fType" field has the value 0 if the entry is a
           directory.  The contents of the "fID" field for a directory
           are interpreted as four 16-bit values in sequence according
           to the following Pascal type definitions:

           ownerID   = Halfword;
           groupID   = Halfword;
           protect   = Halfword;
           linkCount = Halfword;

           The "ownerID" and "groupID" fields indicate the owner of the
           directory.  The "protect" field is the protection bits, or
           access mode, for the directory.  The "linkCount" field
           represents the number of aliases, or links, to the directory
           from other directories in the file system.

      SSSSEEEEEEEE AAAALLLLSSSSOOOO
           CreateSpecial (3B), LookupName (3B), ReadLabel (3B)
           ErBadFileName is returned if the name is too long, or
           contains invalid characters, while ErNotDirectory is
           returned if the name is not a directory.



























      Page 2                                                   (9010-E)



