OLD | NEW |
1 #ifndef»_DIRENT_H | 1 #ifndef _DIRENT_H |
2 #define»_DIRENT_H | 2 #define _DIRENT_H |
3 | 3 |
4 #ifdef __cplusplus | 4 #ifdef __cplusplus |
5 extern "C" { | 5 extern "C" { |
6 #endif | 6 #endif |
7 | 7 |
8 #include <features.h> | 8 #include <features.h> |
9 | 9 |
10 #define __NEED_ino_t | 10 #define __NEED_ino_t |
11 #define __NEED_off_t | 11 #define __NEED_off_t |
12 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) | 12 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) |
13 #define __NEED_size_t | 13 #define __NEED_size_t |
14 #endif | 14 #endif |
15 | 15 |
16 #include <bits/alltypes.h> | 16 #include <bits/alltypes.h> |
17 | 17 |
18 typedef struct __dirstream DIR; | 18 typedef struct __dirstream DIR; |
19 | 19 |
20 struct dirent | 20 struct dirent { |
21 { | 21 ino_t d_ino; |
22 » ino_t d_ino; | 22 off_t d_off; |
23 » off_t d_off; | 23 unsigned short d_reclen; |
24 » unsigned short d_reclen; | 24 unsigned char d_type; |
25 » unsigned char d_type; | 25 char d_name[256]; |
26 » char d_name[256]; | |
27 }; | 26 }; |
28 | 27 |
29 #define d_fileno d_ino | 28 #define d_fileno d_ino |
30 | 29 |
31 int closedir(DIR *); | 30 int closedir(DIR*); |
32 DIR *fdopendir(int); | 31 DIR* fdopendir(int); |
33 DIR *opendir(const char *); | 32 DIR* opendir(const char*); |
34 struct dirent *readdir(DIR *); | 33 struct dirent* readdir(DIR*); |
35 int readdir_r(DIR *__restrict, struct dirent *__restrict, struct dire
nt **__restrict); | 34 int readdir_r(DIR* __restrict, |
36 void rewinddir(DIR *); | 35 struct dirent* __restrict, |
37 void seekdir(DIR *, long); | 36 struct dirent** __restrict); |
38 long telldir(DIR *); | 37 void rewinddir(DIR*); |
39 int dirfd(DIR *); | 38 void seekdir(DIR*, long); |
| 39 long telldir(DIR*); |
| 40 int dirfd(DIR*); |
40 | 41 |
41 int alphasort(const struct dirent **, const struct dirent **); | 42 int alphasort(const struct dirent**, const struct dirent**); |
42 int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int
(*)(const struct dirent **, const struct dirent **)); | 43 int scandir(const char*, |
| 44 struct dirent***, |
| 45 int (*)(const struct dirent*), |
| 46 int (*)(const struct dirent**, const struct dirent**)); |
43 | 47 |
44 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | 48 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
45 #define DT_UNKNOWN 0 | 49 #define DT_UNKNOWN 0 |
46 #define DT_FIFO 1 | 50 #define DT_FIFO 1 |
47 #define DT_CHR 2 | 51 #define DT_CHR 2 |
48 #define DT_DIR 4 | 52 #define DT_DIR 4 |
49 #define DT_BLK 6 | 53 #define DT_BLK 6 |
50 #define DT_REG 8 | 54 #define DT_REG 8 |
51 #define DT_LNK 10 | 55 #define DT_LNK 10 |
52 #define DT_SOCK 12 | 56 #define DT_SOCK 12 |
53 #define DT_WHT 14 | 57 #define DT_WHT 14 |
54 #define IFTODT(x) ((x)>>12 & 017) | 58 #define IFTODT(x) ((x) >> 12 & 017) |
55 #define DTTOIF(x) ((x)<<12) | 59 #define DTTOIF(x) ((x) << 12) |
56 int getdents(int, struct dirent *, size_t); | 60 int getdents(int, struct dirent*, size_t); |
57 #endif | 61 #endif |
58 | 62 |
59 #ifdef _GNU_SOURCE | 63 #ifdef _GNU_SOURCE |
60 int versionsort(const struct dirent **, const struct dirent **); | 64 int versionsort(const struct dirent**, const struct dirent**); |
61 #endif | 65 #endif |
62 | 66 |
63 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) | 67 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) |
64 #define dirent64 dirent | 68 #define dirent64 dirent |
65 #define readdir64 readdir | 69 #define readdir64 readdir |
66 #define readdir64_r readdir_r | 70 #define readdir64_r readdir_r |
67 #define scandir64 scandir | 71 #define scandir64 scandir |
68 #define alphasort64 alphasort | 72 #define alphasort64 alphasort |
69 #define versionsort64 versionsort | 73 #define versionsort64 versionsort |
70 #define off64_t off_t | 74 #define off64_t off_t |
71 #define ino64_t ino_t | 75 #define ino64_t ino_t |
72 #define getdents64 getdents | 76 #define getdents64 getdents |
73 #endif | 77 #endif |
74 | 78 |
75 #ifdef __cplusplus | 79 #ifdef __cplusplus |
76 } | 80 } |
77 #endif | 81 #endif |
78 | 82 |
79 #endif | 83 #endif |
OLD | NEW |