Commit | Line | Data |
---|---|---|
d427b66a | 1 | /* |
95ef7787 | 2 | <dirent.h> -- definitions for POSIX-compatible directory access |
d427b66a | 3 | |
14216c95 GM |
4 | * The code here is forced by the interface, and is not subject to |
5 | * copyright, constituting the only possible expression of the | |
6 | * algorithm in this format. | |
7 | */ | |
d427b66a JB |
8 | |
9 | #define DIRBLKSIZ 512 /* size of directory block */ | |
6cc1fc1d RS |
10 | #ifdef WINDOWSNT |
11 | #define MAXNAMLEN 255 | |
12 | #else /* not WINDOWSNT */ | |
d427b66a | 13 | #define MAXNAMLEN 15 /* maximum filename length */ |
6cc1fc1d | 14 | #endif /* not WINDOWSNT */ |
d427b66a JB |
15 | /* NOTE: MAXNAMLEN must be one less than a multiple of 4 */ |
16 | ||
95ef7787 | 17 | struct dirent /* data from readdir() */ |
d427b66a JB |
18 | { |
19 | long d_ino; /* inode number of entry */ | |
20 | unsigned short d_reclen; /* length of this record */ | |
21 | unsigned short d_namlen; /* length of string in d_name */ | |
22 | char d_name[MAXNAMLEN+1]; /* name of file */ | |
23 | }; | |
24 | ||
25 | typedef struct | |
26 | { | |
27 | int dd_fd; /* file descriptor */ | |
28 | int dd_loc; /* offset in block */ | |
29 | int dd_size; /* amount of valid data */ | |
30 | char dd_buf[DIRBLKSIZ]; /* directory block */ | |
31 | } DIR; /* stream data from opendir() */ | |
32 | ||
cf01a359 | 33 | extern DIR *opendir (const char *); |
95ef7787 | 34 | extern struct dirent *readdir (DIR *); |
361358ea JB |
35 | extern void seekdir (DIR *, long); |
36 | extern void closedir (DIR *); | |
d427b66a JB |
37 | |
38 | #define rewinddir( dirp ) seekdir( dirp, 0L ) |