|
|
1.1 root 1: /* Copyright (c) 1982 Regents of the University of California */
2: /* and modified by pjw in 1986 */
3:
4: /*
5: * this must be a power of 2 and a multiple of all the ones in the system
6: */
7: #define DIRBLKSIZ 512
8:
9: /*
10: * This limits the directory name length. Its main constraint
11: * is that it appears twice in the user structure. (u. area) in bsd systems
12: */
13: #define MAXNAMLEN 255
14:
15: struct direct {
16: unsigned long d_ino;
17: short d_reclen;
18: short d_namlen;
19: char d_name[MAXNAMLEN + 1];
20: /* typically shorter */
21: };
22:
23: struct _dirdesc {
24: int dd_fd;
25: long dd_loc; /* where we left off in dd_buf */
26: long dd_size; /* bytes back from system */
27: long dd_offset; /* lseek at beginning of dd_buf */
28: char dd_buf[DIRBLKSIZ];
29: };
30:
31: /*
32: * useful macros.
33: */
34: #define NDIRSIZ(dp) \
35: ((sizeof(struct direct) - MAXNAMLEN + (dp)->d_namlen + sizeof(ino_t) - 1) &\
36: ~(sizeof(ino_t) - 1))
37: typedef struct _dirdesc DIR;
38: #ifndef NULL
39: #define NULL 0
40: #endif
41:
42: /*
43: * functions defined on directories
44: */
45: extern DIR *opendir();
46: extern struct direct *readdir();
47: extern long telldir();
48: extern void seekdir();
49: #define rewinddir(dirp) seekdir((dirp), 0)
50: extern void closedir();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.