home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archimedes / ardir.h < prev    next >
C/C++ Source or Header  |  2020-01-01  |  1KB  |  44 lines

  1. /* -> h.dir
  2.  *      Cosmos Nicolaou 14/6/87
  3.  *
  4.  *      4.2 BSD style directory operations.
  5.  *      
  6.  */
  7.  
  8. /*
  9.  * osgbpb with r0==9 is used to read directory names;
  10.  * the data returned is copied into a struct dirent.
  11.  */
  12. #define        MAXNAMLEN       255
  13.  
  14. struct dirent {
  15.        unsigned int d_reclen;               /* length of this record */
  16.        unsigned int d_namlen;               /* length of string in d_name */
  17.        char    d_name[MAXNAMLEN + 1];  /* name must be no longer than this */
  18. };
  19.  
  20. /*
  21.  * This macro calculates the amount of storage required for
  22.  * the directory entry.
  23.  */
  24. #undef DIRSIZ
  25. #define DIRSIZ(dp) \
  26.     ((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &3))
  27.  
  28. /*
  29.  * Definitions for library routines operating on directories.
  30.  */
  31. typedef struct _dirdesc {
  32.        long    dd_pos; /* current position in directory. */
  33.        struct dirent *dd_dirent;
  34.        char    dd_name[MAXNAMLEN+1]; /* osgbpb needs a name */
  35.        char    dd_buf[MAXNAMLEN+1]; /* osgbpb needs a buffer */
  36. } DIR;
  37.  
  38. extern DIR *opendir( char * );
  39. extern struct dirent *readdir( DIR * );
  40. extern long telldir( DIR * );
  41. extern void seekdir( DIR *, long );
  42. #define rewinddir(dirp)        seekdir((dirp), (long)0)
  43. extern void closedir( DIR *);
  44.