|
|
1.1 root 1: /*
2: <dirent.h> -- definitions for SVR3 directory access routines
3:
4: last edit: 25-Apr-1987 D A Gwyn
5:
6: Prerequisite: <sys/types.h>
7: */
8:
9: #ifndef _PAX_DIRENT_H
10: #define _PAX_DIRENT_H
11:
12: #include "config.h"
13: #ifdef USG
14: #define UFS
15: #else
16: #ifdef BSD
17: #define BFS
18: #endif
19: #endif
20:
21: struct dirent { /* data from getdents()/readdir() */
22: long d_ino; /* inode number of entry */
23: off_t d_off; /* offset of disk directory entry */
24: unsigned short d_reclen; /* length of this record */
25: char d_name[1]; /* name of file (non-POSIX) */
26: };
27:
28: typedef struct {
29: int dd_fd; /* file descriptor */
30: int dd_loc; /* offset in block */
31: int dd_size; /* amount of valid data */
32: char *dd_buf; /* -> directory block */
33: } DIR; /* stream data from opendir() */
34:
35:
36: /*
37: * The following nonportable ugliness could have been avoided by defining
38: * DIRENTSIZ and DIRENTBASESIZ to also have (struct dirent *) arguments.
39: */
40: #define DIRENTBASESIZ (((struct dirent *)0)->d_name \
41: - (char *)&((struct dirent *)0)->d_ino)
42: #define DIRENTSIZ( namlen ) ((DIRENTBASESIZ + sizeof(long) + (namlen)) \
43: / sizeof(long) * sizeof(long))
44:
45: #define MAXNAMLEN 512 /* maximum filename length */
46:
47: #ifndef NAME_MAX
48: #define NAME_MAX (MAXNAMLEN - 1) /* DAG -- added for POSIX */
49: #endif
50:
51: #define DIRBUF 8192 /* buffer size for fs-indep. dirs */
52: /* must in general be larger than the filesystem buffer size */
53:
54: extern DIR *opendir();
55: extern struct dirent *readdir();
56: extern OFFSET telldir();
57: extern void seekdir();
58: extern int closedir();
59:
60: #endif /* _PAX_DIRENT_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.