132
|
1 /**
|
|
2 * D header file for POSIX.
|
|
3 *
|
|
4 * Copyright: Public Domain
|
|
5 * License: Public Domain
|
|
6 * Authors: Sean Kelly
|
|
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
|
|
8 */
|
|
9 module tango.stdc.posix.dirent;
|
|
10
|
|
11 private import tango.stdc.posix.config;
|
|
12 public import tango.stdc.posix.sys.types; // for ino_t
|
|
13
|
|
14 extern (C):
|
|
15
|
|
16 //
|
|
17 // Required
|
|
18 //
|
|
19 /*
|
|
20 DIR
|
|
21
|
|
22 struct dirent
|
|
23 {
|
|
24 char[] d_name;
|
|
25 }
|
|
26
|
|
27 int closedir(DIR*);
|
|
28 DIR* opendir(char*);
|
|
29 dirent* readdir(DIR*);
|
|
30 void rewinddir(DIR*);
|
|
31 */
|
|
32
|
|
33 version( linux )
|
|
34 {
|
|
35 // NOTE: The following constants are non-standard Linux definitions
|
|
36 // for dirent.d_type.
|
|
37 enum
|
|
38 {
|
|
39 DT_UNKNOWN = 0,
|
|
40 DT_FIFO = 1,
|
|
41 DT_CHR = 2,
|
|
42 DT_DIR = 4,
|
|
43 DT_BLK = 6,
|
|
44 DT_REG = 8,
|
|
45 DT_LNK = 10,
|
|
46 DT_SOCK = 12,
|
|
47 DT_WHT = 14
|
|
48 }
|
|
49
|
|
50 struct dirent
|
|
51 {
|
|
52 ino_t d_ino;
|
|
53 off_t d_off;
|
|
54 ushort d_reclen;
|
|
55 ubyte d_type;
|
|
56 char[256] d_name;
|
|
57 }
|
|
58
|
|
59 struct DIR
|
|
60 {
|
|
61 // Managed by OS
|
|
62 }
|
|
63
|
|
64 dirent* readdir(DIR*);
|
|
65 }
|
|
66 else version( darwin )
|
|
67 {
|
|
68 enum
|
|
69 {
|
|
70 DT_UNKNOWN = 0,
|
|
71 DT_FIFO = 1,
|
|
72 DT_CHR = 2,
|
|
73 DT_DIR = 4,
|
|
74 DT_BLK = 6,
|
|
75 DT_REG = 8,
|
|
76 DT_LNK = 10,
|
|
77 DT_SOCK = 12,
|
|
78 DT_WHT = 14
|
|
79 }
|
|
80
|
|
81 align(4)
|
|
82 struct dirent
|
|
83 {
|
|
84 ino_t d_ino;
|
|
85 ushort d_reclen;
|
|
86 ubyte d_type;
|
|
87 ubyte d_namlen;
|
|
88 char[256] d_name;
|
|
89 }
|
|
90
|
|
91 struct DIR
|
|
92 {
|
|
93 // Managed by OS
|
|
94 }
|
|
95
|
|
96 dirent* readdir(DIR*);
|
|
97 }
|
|
98 else
|
|
99 {
|
|
100 dirent* readdir(DIR*);
|
|
101 }
|
|
102
|
|
103 int closedir(DIR*);
|
|
104 DIR* opendir(char*);
|
|
105 //dirent* readdir(DIR*);
|
|
106 void rewinddir(DIR*);
|
|
107
|
|
108 //
|
|
109 // Thread-Safe Functions (TSF)
|
|
110 //
|
|
111 /*
|
|
112 int readdir_r(DIR*, dirent*, dirent**);
|
|
113 */
|
|
114
|
|
115 int readdir_r(DIR*, dirent*, dirent**);
|
|
116
|
|
117 //
|
|
118 // XOpen (XSI)
|
|
119 //
|
|
120 /*
|
|
121 void seekdir(DIR*, c_long);
|
|
122 c_long telldir(DIR*);
|
|
123 */
|
|
124
|
|
125 version( linux )
|
|
126 {
|
|
127 void seekdir(DIR*, c_long);
|
|
128 c_long telldir(DIR*);
|
|
129 }
|