|
|
1.1 root 1: /*
2: * AT&T Bell Laboratories
3: * directory stream access definitions
4: *
5: * #include <sys/types.h>
6: * #include <dirent.h>
7: *
8: * : : generated by mkhdr and genhdr : :
9: */
10:
11: #ifndef __DIRENT_H__
12:
13: #include <lcldirent.h>
14:
15: #ifndef __DIRENT_H__
16: #define __DIRENT_H__
17: #endif
18:
19: #define _dir_sys 1 /* #include <sys/dir.h> ok */
20:
21: #ifndef d_fileno
22: #define d_fileno d_ino
23: #endif
24:
25: #ifndef _lcl_dirent
26:
27: #ifdef _dir_sys
28:
29: #include <sys/dir.h>
30:
31: #else
32:
33: #undef _dir_rewinddir
34:
35: #define DIRSIZ 14
36:
37: struct direct
38: {
39: short d_ino;
40: char d_name[DIRSIZ];
41: };
42:
43: #endif
44:
45: #ifdef _dir_rewinddir
46:
47: /*
48: * variable length directory entry format
49: */
50:
51: #define _dir_variable
52:
53: #ifndef dirent
54: #define dirent direct
55: #endif
56:
57: #else
58:
59: /*
60: * fixed length directory entry format
61: */
62:
63: #define _dir_fixed
64:
65: #ifndef DIRSIZ
66: #define DIRSIZ 14 /* maximum entry link length */
67: #endif
68:
69: #ifndef MAXNAMLEN
70: #define MAXNAMLEN DIRSIZ /* maximum filename length */
71: #endif
72:
73: #ifdef _dir_getdents
74:
75: struct dirent /* data from local getdents() */
76: {
77: long d_ino; /* file number of entry */
78: long d_off; /* entry seek offset */
79: unsigned short d_reclen; /* length of this record */
80: char d_name[1]; /* link name */
81: };
82:
83: #else
84:
85: #ifndef _dir_namlen
86: #define _dir_namlen 1
87: #endif
88:
89: struct dirent /* data from readdir() */
90: {
91: long d_fileno; /* file number of entry */
92: unsigned short d_reclen; /* length of this record */
93: unsigned short d_namlen; /* strlen(d_name) */
94: char d_name[1]; /* link name */
95: };
96:
97: #endif
98:
99: typedef struct
100: {
101: int dd_fd; /* file descriptor */
102: int dd_loc; /* offset in block */
103: int dd_size; /* amount of valid data */
104: char* dd_buf; /* directory block */
105: } DIR; /* stream data from opendir() */
106:
107: extern DIR* opendir();
108: extern struct dirent* readdir();
109: extern long telldir();
110: extern void seekdir();
111: extern void closedir();
112:
113: #if !_dir_local
114: #define rewinddir(dirp) seekdir(dirp,0L)
115: #endif
116:
117: #endif
118:
119: #endif
120:
121: #if _dir_namlen
122: #define DIRNAMLEN(d) ((d)->d_namlen)
123: #else
124: #define DIRNAMLEN(d) strlen((d)->d_name)
125: #endif
126:
127: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.