| 1 |
/* |
| 2 |
* dirent.h -- |
| 3 |
* |
| 4 |
* Declarations of a library of directory-reading procedures |
| 5 |
* in the POSIX style ("struct dirent"). |
| 6 |
* |
| 7 |
* Copyright (c) 1991 The Regents of the University of California. |
| 8 |
* Copyright (c) 1994 Sun Microsystems, Inc. |
| 9 |
* |
| 10 |
* See the file "license.terms" for information on usage and redistribution |
| 11 |
* of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 12 |
*/ |
| 13 |
|
| 14 |
#ifndef _DIRENT |
| 15 |
#define _DIRENT |
| 16 |
|
| 17 |
/* |
| 18 |
* Dirent structure, which holds information about a single |
| 19 |
* directory entry. |
| 20 |
*/ |
| 21 |
|
| 22 |
#define MAXNAMLEN 255 |
| 23 |
#define DIRBLKSIZ 512 |
| 24 |
|
| 25 |
struct dirent { |
| 26 |
long d_ino; /* Inode number of entry */ |
| 27 |
short d_reclen; /* Length of this record */ |
| 28 |
short d_namlen; /* Length of string in d_name */ |
| 29 |
char d_name[MAXNAMLEN + 1]; /* Name must be no longer than this */ |
| 30 |
}; |
| 31 |
|
| 32 |
/* |
| 33 |
* State that keeps track of the reading of a directory (clients |
| 34 |
* should never look inside this structure; the fields should |
| 35 |
* only be accessed by the library procedures). |
| 36 |
*/ |
| 37 |
|
| 38 |
typedef struct _dirdesc { |
| 39 |
int dd_fd; |
| 40 |
long dd_loc; |
| 41 |
long dd_size; |
| 42 |
char dd_buf[DIRBLKSIZ]; |
| 43 |
} DIR; |
| 44 |
|
| 45 |
/* |
| 46 |
* Procedures defined for reading directories: |
| 47 |
*/ |
| 48 |
|
| 49 |
extern void closedir (DIR *dirp); |
| 50 |
extern DIR * opendir (char *name); |
| 51 |
extern struct dirent * readdir (DIR *dirp); |
| 52 |
|
| 53 |
#endif /* _DIRENT */ |