Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 1 | /* <dir.h> -- definitions for 4.2BSD-compatible directory access. |
| 2 | last edit: 09-Jul-1983 D A Gwyn. */ |
| 3 | |
| 4 | #if defined (VMS) |
| 5 | # if !defined (FAB$C_BID) |
| 6 | # include <fab.h> |
| 7 | # endif |
| 8 | # if !defined (NAM$C_BID) |
| 9 | # include <nam.h> |
| 10 | # endif |
| 11 | # if !defined (RMS$_SUC) |
| 12 | # include <rmsdef.h> |
| 13 | # endif |
| 14 | # include "dir.h" |
| 15 | #endif /* VMS */ |
| 16 | |
| 17 | /* Size of directory block. */ |
| 18 | #define DIRBLKSIZ 512 |
| 19 | |
| 20 | /* NOTE: MAXNAMLEN must be one less than a multiple of 4 */ |
| 21 | |
| 22 | #if defined (VMS) |
| 23 | # define MAXNAMLEN (DIR$S_NAME + 7) /* 80 plus room for version #. */ |
| 24 | # define MAXFULLSPEC NAM$C_MAXRSS /* Maximum full spec */ |
| 25 | #else |
| 26 | # define MAXNAMLEN 15 /* Maximum filename length. */ |
| 27 | #endif /* VMS */ |
| 28 | |
| 29 | /* Data from readdir (). */ |
| 30 | struct direct { |
| 31 | long d_ino; /* Inode number of entry. */ |
| 32 | unsigned short d_reclen; /* Length of this record. */ |
| 33 | unsigned short d_namlen; /* Length of string in d_name. */ |
| 34 | char d_name[MAXNAMLEN + 1]; /* Name of file. */ |
| 35 | }; |
| 36 | |
| 37 | /* Stream data from opendir (). */ |
| 38 | typedef struct { |
| 39 | int dd_fd; /* File descriptor. */ |
| 40 | int dd_loc; /* Offset in block. */ |
| 41 | int dd_size; /* Amount of valid data. */ |
| 42 | char dd_buf[DIRBLKSIZ]; /* Directory block. */ |
| 43 | } DIR; |
| 44 | |
| 45 | extern DIR *opendir (); |
| 46 | extern struct direct *readdir (); |
| 47 | extern long telldir (); |
| 48 | extern void seekdir (), closedir (); |
| 49 | |
| 50 | #define rewinddir(dirp) seekdir (dirp, 0L) |