1 | /* Copyright (c) 1988 AT&T */ |
---|
2 | /* All Rights Reserved */ |
---|
3 | |
---|
4 | /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ |
---|
5 | /* The copyright notice above does not evidence any */ |
---|
6 | /* actual or intended publication of such source code. */ |
---|
7 | |
---|
8 | #ifndef _DIRENT_H |
---|
9 | #define _DIRENT_H |
---|
10 | |
---|
11 | #pragma ident "@(#)dirent.h 1.16 93/08/20 SMI" /* SVr4.0 1.6.1.5 */ |
---|
12 | |
---|
13 | #include <sys/feature_tests.h> |
---|
14 | |
---|
15 | #include <sys/types.h> |
---|
16 | |
---|
17 | #ifdef __cplusplus |
---|
18 | extern "C" { |
---|
19 | #endif |
---|
20 | |
---|
21 | #if !defined(_POSIX_C_SOURCE) |
---|
22 | #define MAXNAMLEN 512 /* maximum filename length */ |
---|
23 | #define DIRBUF 1048 /* buffer size for fs-indep. dirs */ |
---|
24 | #endif /* !defined(_POSIX_C_SOURCE) */ |
---|
25 | |
---|
26 | typedef struct |
---|
27 | { |
---|
28 | int dd_fd; /* file descriptor */ |
---|
29 | int dd_loc; /* offset in block */ |
---|
30 | int dd_size; /* amount of valid data */ |
---|
31 | char *dd_buf; /* directory block */ |
---|
32 | } DIR; /* stream data from opendir() */ |
---|
33 | |
---|
34 | #if defined(__STDC__) |
---|
35 | |
---|
36 | extern DIR *opendir(const char *); |
---|
37 | extern struct dirent *readdir(DIR *); |
---|
38 | #ifdef _REENTRANT |
---|
39 | extern struct dirent *readdir_r(DIR *, struct dirent *); |
---|
40 | #endif /* _REENTRANT */ |
---|
41 | #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) |
---|
42 | extern long telldir(DIR *); |
---|
43 | extern void seekdir(DIR *, long); |
---|
44 | #endif /* !defined(_POSIX_C_SOURCE) */ |
---|
45 | extern void rewinddir(DIR *); |
---|
46 | extern int closedir(DIR *); |
---|
47 | |
---|
48 | #else |
---|
49 | |
---|
50 | extern DIR *opendir(); |
---|
51 | extern struct dirent *readdir(); |
---|
52 | #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) |
---|
53 | extern long telldir(); |
---|
54 | extern void seekdir(); |
---|
55 | #endif /* !defined(_POSIX_C_SOURCE) */ |
---|
56 | extern void rewinddir(); |
---|
57 | extern int closedir(); |
---|
58 | |
---|
59 | #endif |
---|
60 | |
---|
61 | #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) |
---|
62 | #define rewinddir(dirp) seekdir(dirp, 0L) |
---|
63 | #endif |
---|
64 | |
---|
65 | #ifdef __cplusplus |
---|
66 | } |
---|
67 | #endif |
---|
68 | |
---|
69 | #ifndef _SYS_DIRENT_H |
---|
70 | #define _SYS_DIRENT_H |
---|
71 | |
---|
72 | #include <sys/feature_tests.h> |
---|
73 | |
---|
74 | #ifdef __cplusplus |
---|
75 | extern "C" { |
---|
76 | #endif |
---|
77 | |
---|
78 | /* |
---|
79 | * File-system independent directory entry. |
---|
80 | */ |
---|
81 | struct dirent { |
---|
82 | ino_t d_ino; /* "inode number" of entry */ |
---|
83 | off_t d_off; /* offset of disk directory entry */ |
---|
84 | unsigned short d_reclen; /* length of this record */ |
---|
85 | char d_name[MAXNAMELEN+1]; /* name of file */ |
---|
86 | }; |
---|
87 | |
---|
88 | typedef struct dirent dirent_t; |
---|
89 | |
---|
90 | #if !defined(_POSIX_C_SOURCE) |
---|
91 | #if defined(__STDC__) && !defined(_KERNEL) |
---|
92 | int getdents(int, struct dirent *, unsigned); |
---|
93 | #else |
---|
94 | int getdents(); |
---|
95 | #endif |
---|
96 | #endif /* !defined(_POSIX_C_SOURCE) */ |
---|
97 | |
---|
98 | #ifdef __cplusplus |
---|
99 | } |
---|
100 | #endif |
---|
101 | |
---|
102 | #endif /* _SYS_DIRENT_H */ |
---|
103 | |
---|
104 | |
---|
105 | #endif /* _DIRENT_H */ |
---|