diff options
Diffstat (limited to 'src/include/plibc.h')
-rw-r--r-- | src/include/plibc.h | 1020 |
1 files changed, 514 insertions, 506 deletions
diff --git a/src/include/plibc.h b/src/include/plibc.h index a59e53de9..82079faf1 100644 --- a/src/include/plibc.h +++ b/src/include/plibc.h | |||
@@ -29,17 +29,18 @@ | |||
29 | #define _PLIBC_H_ | 29 | #define _PLIBC_H_ |
30 | 30 | ||
31 | #ifndef SIGALRM | 31 | #ifndef SIGALRM |
32 | #define SIGALRM 14 | 32 | #define SIGALRM 14 |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #ifdef __cplusplus | 35 | #ifdef __cplusplus |
36 | extern "C" { | 36 | extern "C" |
37 | { | ||
37 | #endif | 38 | #endif |
38 | 39 | ||
39 | #include <stddef.h> | 40 | #include <stddef.h> |
40 | 41 | ||
41 | #ifdef Q_OS_WIN32 | 42 | #ifdef Q_OS_WIN32 |
42 | #define WINDOWS 1 | 43 | #define WINDOWS 1 |
43 | #endif | 44 | #endif |
44 | 45 | ||
45 | #define HAVE_PLIBC_FD 0 | 46 | #define HAVE_PLIBC_FD 0 |
@@ -47,7 +48,7 @@ extern "C" { | |||
47 | #ifdef WINDOWS | 48 | #ifdef WINDOWS |
48 | 49 | ||
49 | #if ENABLE_NLS | 50 | #if ENABLE_NLS |
50 | #include "langinfo.h" | 51 | #include "langinfo.h" |
51 | #endif | 52 | #endif |
52 | 53 | ||
53 | #include <winsock2.h> | 54 | #include <winsock2.h> |
@@ -72,8 +73,8 @@ extern "C" { | |||
72 | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ | 73 | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ |
73 | (double)((x).LowPart)) | 74 | (double)((x).LowPart)) |
74 | 75 | ||
75 | struct stat64 | 76 | struct stat64 |
76 | { | 77 | { |
77 | _dev_t st_dev; | 78 | _dev_t st_dev; |
78 | _ino_t st_ino; | 79 | _ino_t st_ino; |
79 | _mode_t st_mode; | 80 | _mode_t st_mode; |
@@ -85,133 +86,134 @@ struct stat64 | |||
85 | __time64_t st_atime; | 86 | __time64_t st_atime; |
86 | __time64_t st_mtime; | 87 | __time64_t st_mtime; |
87 | __time64_t st_ctime; | 88 | __time64_t st_ctime; |
88 | }; | 89 | }; |
89 | 90 | ||
90 | typedef unsigned int sa_family_t; | 91 | typedef unsigned int sa_family_t; |
91 | 92 | ||
92 | struct sockaddr_un { | 93 | struct sockaddr_un |
93 | short sun_family; /*AF_UNIX*/ | 94 | { |
94 | char sun_path[108]; /*path name */ | 95 | short sun_family; /*AF_UNIX */ |
95 | }; | 96 | char sun_path[108]; /*path name */ |
97 | }; | ||
96 | 98 | ||
97 | #ifndef pid_t | 99 | #ifndef pid_t |
98 | #define pid_t DWORD | 100 | #define pid_t DWORD |
99 | #endif | 101 | #endif |
100 | 102 | ||
101 | #ifndef error_t | 103 | #ifndef error_t |
102 | #define error_t int | 104 | #define error_t int |
103 | #endif | 105 | #endif |
104 | 106 | ||
105 | #ifndef WEXITSTATUS | 107 | #ifndef WEXITSTATUS |
106 | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) | 108 | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) |
107 | #endif | 109 | #endif |
108 | 110 | ||
109 | #ifndef MSG_DONTWAIT | 111 | #ifndef MSG_DONTWAIT |
110 | #define MSG_DONTWAIT 0 | 112 | #define MSG_DONTWAIT 0 |
111 | #endif | 113 | #endif |
112 | 114 | ||
113 | enum | 115 | enum |
114 | { | 116 | { |
115 | _SC_PAGESIZE = 30, | 117 | _SC_PAGESIZE = 30, |
116 | _SC_PAGE_SIZE = 30 | 118 | _SC_PAGE_SIZE = 30 |
117 | }; | 119 | }; |
118 | 120 | ||
119 | /* Thanks to the Cygwin project */ | 121 | /* Thanks to the Cygwin project */ |
120 | #define ENOCSI 43 /* No CSI structure available */ | 122 | #define ENOCSI 43 /* No CSI structure available */ |
121 | #define EL2HLT 44 /* Level 2 halted */ | 123 | #define EL2HLT 44 /* Level 2 halted */ |
122 | #ifndef EDEADLK | 124 | #ifndef EDEADLK |
123 | #define EDEADLK 45 /* Deadlock condition */ | 125 | #define EDEADLK 45 /* Deadlock condition */ |
124 | #endif | 126 | #endif |
125 | #ifndef ENOLCK | 127 | #ifndef ENOLCK |
126 | #define ENOLCK 46 /* No record locks available */ | 128 | #define ENOLCK 46 /* No record locks available */ |
127 | #endif | 129 | #endif |
128 | #define EBADE 50 /* Invalid exchange */ | 130 | #define EBADE 50 /* Invalid exchange */ |
129 | #define EBADR 51 /* Invalid request descriptor */ | 131 | #define EBADR 51 /* Invalid request descriptor */ |
130 | #define EXFULL 52 /* Exchange full */ | 132 | #define EXFULL 52 /* Exchange full */ |
131 | #define ENOANO 53 /* No anode */ | 133 | #define ENOANO 53 /* No anode */ |
132 | #define EBADRQC 54 /* Invalid request code */ | 134 | #define EBADRQC 54 /* Invalid request code */ |
133 | #define EBADSLT 55 /* Invalid slot */ | 135 | #define EBADSLT 55 /* Invalid slot */ |
134 | #ifndef EDEADLOCK | 136 | #ifndef EDEADLOCK |
135 | #define EDEADLOCK EDEADLK /* File locking deadlock error */ | 137 | #define EDEADLOCK EDEADLK /* File locking deadlock error */ |
136 | #endif | 138 | #endif |
137 | #define EBFONT 57 /* Bad font file fmt */ | 139 | #define EBFONT 57 /* Bad font file fmt */ |
138 | #define ENOSTR 60 /* Device not a stream */ | 140 | #define ENOSTR 60 /* Device not a stream */ |
139 | #define ENODATA 61 /* No data (for no delay io) */ | 141 | #define ENODATA 61 /* No data (for no delay io) */ |
140 | #define ETIME 62 /* Timer expired */ | 142 | #define ETIME 62 /* Timer expired */ |
141 | #define ENOSR 63 /* Out of streams resources */ | 143 | #define ENOSR 63 /* Out of streams resources */ |
142 | #define ENONET 64 /* Machine is not on the network */ | 144 | #define ENONET 64 /* Machine is not on the network */ |
143 | #define ENOPKG 65 /* Package not installed */ | 145 | #define ENOPKG 65 /* Package not installed */ |
144 | #define EREMOTE 66 /* The object is remote */ | 146 | #define EREMOTE 66 /* The object is remote */ |
145 | #define ENOLINK 67 /* The link has been severed */ | 147 | #define ENOLINK 67 /* The link has been severed */ |
146 | #define EADV 68 /* Advertise error */ | 148 | #define EADV 68 /* Advertise error */ |
147 | #define ESRMNT 69 /* Srmount error */ | 149 | #define ESRMNT 69 /* Srmount error */ |
148 | #define ECOMM 70 /* Communication error on send */ | 150 | #define ECOMM 70 /* Communication error on send */ |
149 | #define EPROTO 71 /* Protocol error */ | 151 | #define EPROTO 71 /* Protocol error */ |
150 | #define EMULTIHOP 74 /* Multihop attempted */ | 152 | #define EMULTIHOP 74 /* Multihop attempted */ |
151 | #define ELBIN 75 /* Inode is remote (not really error) */ | 153 | #define ELBIN 75 /* Inode is remote (not really error) */ |
152 | #define EDOTDOT 76 /* Cross mount point (not really error) */ | 154 | #define EDOTDOT 76 /* Cross mount point (not really error) */ |
153 | #define EBADMSG 77 /* Trying to read unreadable message */ | 155 | #define EBADMSG 77 /* Trying to read unreadable message */ |
154 | #define ENOTUNIQ 80 /* Given log. name not unique */ | 156 | #define ENOTUNIQ 80 /* Given log. name not unique */ |
155 | #define EBADFD 81 /* f.d. invalid for this operation */ | 157 | #define EBADFD 81 /* f.d. invalid for this operation */ |
156 | #define EREMCHG 82 /* Remote address changed */ | 158 | #define EREMCHG 82 /* Remote address changed */ |
157 | #define ELIBACC 83 /* Can't access a needed shared lib */ | 159 | #define ELIBACC 83 /* Can't access a needed shared lib */ |
158 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ | 160 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ |
159 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ | 161 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ |
160 | #define ELIBMAX 86 /* Attempting to link in too many libs */ | 162 | #define ELIBMAX 86 /* Attempting to link in too many libs */ |
161 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ | 163 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ |
162 | #ifndef ENOSYS | 164 | #ifndef ENOSYS |
163 | #define ENOSYS 88 /* Function not implemented */ | 165 | #define ENOSYS 88 /* Function not implemented */ |
164 | #endif | 166 | #endif |
165 | #define ENMFILE 89 /* No more files */ | 167 | #define ENMFILE 89 /* No more files */ |
166 | #ifndef ENOTEMPTY | 168 | #ifndef ENOTEMPTY |
167 | #define ENOTEMPTY 90 /* Directory not empty */ | 169 | #define ENOTEMPTY 90 /* Directory not empty */ |
168 | #endif | 170 | #endif |
169 | #ifndef ENAMETOOLONG | 171 | #ifndef ENAMETOOLONG |
170 | #define ENAMETOOLONG 91 /* File or path name too long */ | 172 | #define ENAMETOOLONG 91 /* File or path name too long */ |
171 | #endif | 173 | #endif |
172 | #define ELOOP 92 /* Too many symbolic links */ | 174 | #define ELOOP 92 /* Too many symbolic links */ |
173 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ | 175 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ |
174 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ | 176 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ |
175 | #define ECONNRESET 104 /* Connection reset by peer */ | 177 | #define ECONNRESET 104 /* Connection reset by peer */ |
176 | #define ENOBUFS 105 /* No buffer space available */ | 178 | #define ENOBUFS 105 /* No buffer space available */ |
177 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ | 179 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ |
178 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ | 180 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ |
179 | #define ENOTSOCK 108 /* Socket operation on non-socket */ | 181 | #define ENOTSOCK 108 /* Socket operation on non-socket */ |
180 | #define ENOPROTOOPT 109 /* Protocol not available */ | 182 | #define ENOPROTOOPT 109 /* Protocol not available */ |
181 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ | 183 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ |
182 | #define ECONNREFUSED 111 /* Connection refused */ | 184 | #define ECONNREFUSED 111 /* Connection refused */ |
183 | #define EADDRINUSE 112 /* Address already in use */ | 185 | #define EADDRINUSE 112 /* Address already in use */ |
184 | #define ECONNABORTED 113 /* Connection aborted */ | 186 | #define ECONNABORTED 113 /* Connection aborted */ |
185 | #define ENETUNREACH 114 /* Network is unreachable */ | 187 | #define ENETUNREACH 114 /* Network is unreachable */ |
186 | #define ENETDOWN 115 /* Network interface is not configured */ | 188 | #define ENETDOWN 115 /* Network interface is not configured */ |
187 | #ifndef ETIMEDOUT | 189 | #ifndef ETIMEDOUT |
188 | #define ETIMEDOUT 116 /* Connection timed out */ | 190 | #define ETIMEDOUT 116 /* Connection timed out */ |
189 | #endif | 191 | #endif |
190 | #define EHOSTDOWN 117 /* Host is down */ | 192 | #define EHOSTDOWN 117 /* Host is down */ |
191 | #define EHOSTUNREACH 118 /* Host is unreachable */ | 193 | #define EHOSTUNREACH 118 /* Host is unreachable */ |
192 | #define EINPROGRESS 119 /* Connection already in progress */ | 194 | #define EINPROGRESS 119 /* Connection already in progress */ |
193 | #define EALREADY 120 /* Socket already connected */ | 195 | #define EALREADY 120 /* Socket already connected */ |
194 | #define EDESTADDRREQ 121 /* Destination address required */ | 196 | #define EDESTADDRREQ 121 /* Destination address required */ |
195 | #define EMSGSIZE 122 /* Message too long */ | 197 | #define EMSGSIZE 122 /* Message too long */ |
196 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ | 198 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ |
197 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ | 199 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ |
198 | #define EADDRNOTAVAIL 125 /* Address not available */ | 200 | #define EADDRNOTAVAIL 125 /* Address not available */ |
199 | #define ENETRESET 126 /* Connection aborted by network */ | 201 | #define ENETRESET 126 /* Connection aborted by network */ |
200 | #define EISCONN 127 /* Socket is already connected */ | 202 | #define EISCONN 127 /* Socket is already connected */ |
201 | #define ENOTCONN 128 /* Socket is not connected */ | 203 | #define ENOTCONN 128 /* Socket is not connected */ |
202 | #define ETOOMANYREFS 129 /* Too many references: cannot splice */ | 204 | #define ETOOMANYREFS 129 /* Too many references: cannot splice */ |
203 | #define EPROCLIM 130 /* Too many processes */ | 205 | #define EPROCLIM 130 /* Too many processes */ |
204 | #define EUSERS 131 /* Too many users */ | 206 | #define EUSERS 131 /* Too many users */ |
205 | #define EDQUOT 132 /* Disk quota exceeded */ | 207 | #define EDQUOT 132 /* Disk quota exceeded */ |
206 | #define ESTALE 133 /* Unknown error */ | 208 | #define ESTALE 133 /* Unknown error */ |
207 | #ifndef ENOTSUP | 209 | #ifndef ENOTSUP |
208 | #define ENOTSUP 134 /* Not supported */ | 210 | #define ENOTSUP 134 /* Not supported */ |
209 | #endif | 211 | #endif |
210 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ | 212 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ |
211 | #define ENOSHARE 136 /* No such host or network path */ | 213 | #define ENOSHARE 136 /* No such host or network path */ |
212 | #define ECASECLASH 137 /* Filename exists with different case */ | 214 | #define ECASECLASH 137 /* Filename exists with different case */ |
213 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | 215 | #define EWOULDBLOCK EAGAIN /* Operation would block */ |
214 | #define EOVERFLOW 139 /* Value too large for defined data type */ | 216 | #define EOVERFLOW 139 /* Value too large for defined data type */ |
215 | 217 | ||
216 | #undef HOST_NOT_FOUND | 218 | #undef HOST_NOT_FOUND |
217 | #define HOST_NOT_FOUND 1 | 219 | #define HOST_NOT_FOUND 1 |
@@ -225,68 +227,68 @@ enum | |||
225 | #define PROT_READ 0x1 | 227 | #define PROT_READ 0x1 |
226 | #define PROT_WRITE 0x2 | 228 | #define PROT_WRITE 0x2 |
227 | #define MAP_SHARED 0x1 | 229 | #define MAP_SHARED 0x1 |
228 | #define MAP_PRIVATE 0x2 /* unsupported */ | 230 | #define MAP_PRIVATE 0x2 /* unsupported */ |
229 | #define MAP_FIXED 0x10 | 231 | #define MAP_FIXED 0x10 |
230 | #define MAP_FAILED ((void *)-1) | 232 | #define MAP_FAILED ((void *)-1) |
231 | 233 | ||
232 | struct statfs | 234 | struct statfs |
233 | { | 235 | { |
234 | long f_type; /* type of filesystem (see below) */ | 236 | long f_type; /* type of filesystem (see below) */ |
235 | long f_bsize; /* optimal transfer block size */ | 237 | long f_bsize; /* optimal transfer block size */ |
236 | long f_blocks; /* total data blocks in file system */ | 238 | long f_blocks; /* total data blocks in file system */ |
237 | long f_bfree; /* free blocks in fs */ | 239 | long f_bfree; /* free blocks in fs */ |
238 | long f_bavail; /* free blocks avail to non-superuser */ | 240 | long f_bavail; /* free blocks avail to non-superuser */ |
239 | long f_files; /* total file nodes in file system */ | 241 | long f_files; /* total file nodes in file system */ |
240 | long f_ffree; /* free file nodes in fs */ | 242 | long f_ffree; /* free file nodes in fs */ |
241 | long f_fsid; /* file system id */ | 243 | long f_fsid; /* file system id */ |
242 | long f_namelen; /* maximum length of filenames */ | 244 | long f_namelen; /* maximum length of filenames */ |
243 | long f_spare[6]; /* spare for later */ | 245 | long f_spare[6]; /* spare for later */ |
244 | }; | 246 | }; |
245 | 247 | ||
246 | extern const struct in6_addr in6addr_any; /* :: */ | 248 | extern const struct in6_addr in6addr_any; /* :: */ |
247 | extern const struct in6_addr in6addr_loopback; /* ::1 */ | 249 | extern const struct in6_addr in6addr_loopback; /* ::1 */ |
248 | 250 | ||
249 | /* Taken from the Wine project <http://www.winehq.org> | 251 | /* Taken from the Wine project <http://www.winehq.org> |
250 | /wine/include/winternl.h */ | 252 | /wine/include/winternl.h */ |
251 | enum SYSTEM_INFORMATION_CLASS | 253 | enum SYSTEM_INFORMATION_CLASS |
252 | { | 254 | { |
253 | SystemBasicInformation = 0, | 255 | SystemBasicInformation = 0, |
254 | Unknown1, | 256 | Unknown1, |
255 | SystemPerformanceInformation = 2, | 257 | SystemPerformanceInformation = 2, |
256 | SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ | 258 | SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ |
257 | Unknown4, | 259 | Unknown4, |
258 | SystemProcessInformation = 5, | 260 | SystemProcessInformation = 5, |
259 | Unknown6, | 261 | Unknown6, |
260 | Unknown7, | 262 | Unknown7, |
261 | SystemProcessorPerformanceInformation = 8, | 263 | SystemProcessorPerformanceInformation = 8, |
262 | Unknown9, | 264 | Unknown9, |
263 | Unknown10, | 265 | Unknown10, |
264 | SystemDriverInformation, | 266 | SystemDriverInformation, |
265 | Unknown12, | 267 | Unknown12, |
266 | Unknown13, | 268 | Unknown13, |
267 | Unknown14, | 269 | Unknown14, |
268 | Unknown15, | 270 | Unknown15, |
269 | SystemHandleList, | 271 | SystemHandleList, |
270 | Unknown17, | 272 | Unknown17, |
271 | Unknown18, | 273 | Unknown18, |
272 | Unknown19, | 274 | Unknown19, |
273 | Unknown20, | 275 | Unknown20, |
274 | SystemCacheInformation, | 276 | SystemCacheInformation, |
275 | Unknown22, | 277 | Unknown22, |
276 | SystemInterruptInformation = 23, | 278 | SystemInterruptInformation = 23, |
277 | SystemExceptionInformation = 33, | 279 | SystemExceptionInformation = 33, |
278 | SystemRegistryQuotaInformation = 37, | 280 | SystemRegistryQuotaInformation = 37, |
279 | SystemLookasideInformation = 45 | 281 | SystemLookasideInformation = 45 |
280 | }; | 282 | }; |
281 | 283 | ||
282 | typedef struct | 284 | typedef struct |
283 | { | 285 | { |
284 | LARGE_INTEGER IdleTime; | 286 | LARGE_INTEGER IdleTime; |
285 | LARGE_INTEGER KernelTime; | 287 | LARGE_INTEGER KernelTime; |
286 | LARGE_INTEGER UserTime; | 288 | LARGE_INTEGER UserTime; |
287 | LARGE_INTEGER Reserved1[2]; | 289 | LARGE_INTEGER Reserved1[2]; |
288 | ULONG Reserved2; | 290 | ULONG Reserved2; |
289 | } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; | 291 | } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; |
290 | 292 | ||
291 | #define sleep(secs) (Sleep(secs * 1000)) | 293 | #define sleep(secs) (Sleep(secs * 1000)) |
292 | 294 | ||
@@ -303,11 +305,11 @@ typedef struct | |||
303 | #define SHUT_RDWR SD_BOTH | 305 | #define SHUT_RDWR SD_BOTH |
304 | 306 | ||
305 | /* Operations for flock() */ | 307 | /* Operations for flock() */ |
306 | #define LOCK_SH 1 /* shared lock */ | 308 | #define LOCK_SH 1 /* shared lock */ |
307 | #define LOCK_EX 2 /* exclusive lock */ | 309 | #define LOCK_EX 2 /* exclusive lock */ |
308 | #define LOCK_NB 4 /* or'd with one of the above to prevent | 310 | #define LOCK_NB 4 /* or'd with one of the above to prevent |
309 | blocking */ | 311 | * blocking */ |
310 | #define LOCK_UN 8 /* remove lock */ | 312 | #define LOCK_UN 8 /* remove lock */ |
311 | 313 | ||
312 | /* Not supported under MinGW */ | 314 | /* Not supported under MinGW */ |
313 | #define S_IRGRP 0 | 315 | #define S_IRGRP 0 |
@@ -331,330 +333,331 @@ typedef struct | |||
331 | 333 | ||
332 | #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__) | 334 | #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__) |
333 | 335 | ||
334 | BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); | 336 | BOOL _plibc_CreateShortcut (const char *pszSrc, const char *pszDest); |
335 | BOOL _plibc_DereferenceShortcut(char *pszShortcut); | 337 | BOOL _plibc_DereferenceShortcut (char *pszShortcut); |
336 | char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); | 338 | char *plibc_ChooseDir (char *pszTitle, unsigned long ulFlags); |
337 | char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); | 339 | char *plibc_ChooseFile (char *pszTitle, unsigned long ulFlags); |
338 | long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey, | 340 | long QueryRegistry (HKEY hMainKey, const char *pszKey, const char *pszSubKey, |
339 | char *pszBuffer, long *pdLength); | 341 | char *pszBuffer, long *pdLength); |
340 | 342 | ||
341 | BOOL __win_IsHandleMarkedAsBlocking(int hHandle); | 343 | BOOL __win_IsHandleMarkedAsBlocking (int hHandle); |
342 | void __win_SetHandleBlockingMode(int s, BOOL bBlocking); | 344 | void __win_SetHandleBlockingMode (int s, BOOL bBlocking); |
343 | void __win_DiscardHandleBlockingMode(int s); | 345 | void __win_DiscardHandleBlockingMode (int s); |
344 | int _win_isSocketValid(int s); | 346 | int _win_isSocketValid (int s); |
345 | int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); | 347 | int plibc_conv_to_win_path (const char *pszUnix, char *pszWindows); |
346 | unsigned plibc_get_handle_count(); | 348 | unsigned plibc_get_handle_count (); |
347 | 349 | ||
348 | typedef void (*TPanicProc) (int, char *); | 350 | typedef void (*TPanicProc) (int, char *); |
349 | void plibc_set_panic_proc(TPanicProc proc); | 351 | void plibc_set_panic_proc (TPanicProc proc); |
350 | 352 | ||
351 | int flock(int fd, int operation); | 353 | int flock (int fd, int operation); |
352 | int fsync(int fildes); | 354 | int fsync (int fildes); |
353 | int inet_pton(int af, const char *src, void *dst); | 355 | int inet_pton (int af, const char *src, void *dst); |
354 | int inet_pton4(const char *src, u_char *dst, int pton); | 356 | int inet_pton4 (const char *src, u_char * dst, int pton); |
355 | #if USE_IPV6 | 357 | #if USE_IPV6 |
356 | int inet_pton6(const char *src, u_char *dst); | 358 | int inet_pton6 (const char *src, u_char * dst); |
357 | #endif | 359 | #endif |
358 | int truncate(const char *fname, int distance); | 360 | int truncate (const char *fname, int distance); |
359 | int statfs(const char *path, struct statfs *buf); | 361 | int statfs (const char *path, struct statfs *buf); |
360 | const char *hstrerror(int err); | 362 | const char *hstrerror (int err); |
361 | int mkstemp(char *tmplate); | 363 | int mkstemp (char *tmplate); |
362 | char *strptime (const char *buf, const char *format, struct tm *tm); | 364 | char *strptime (const char *buf, const char *format, struct tm *tm); |
363 | const char *inet_ntop(int af, const void *src, char *dst, size_t size); | 365 | const char *inet_ntop (int af, const void *src, char *dst, size_t size); |
364 | 366 | ||
365 | int plibc_init(char *pszOrg, char *pszApp); | 367 | int plibc_init (char *pszOrg, char *pszApp); |
366 | void plibc_shutdown(); | 368 | void plibc_shutdown (); |
367 | int plibc_initialized(); | 369 | int plibc_initialized (); |
368 | int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int derefLinks); | 370 | int plibc_conv_to_win_path_ex (const char *pszUnix, char *pszWindows, |
369 | void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); | 371 | int derefLinks); |
370 | void SetErrnoFromWinsockError(long lWinError); | 372 | void _SetErrnoFromWinError (long lWinError, char *pszCaller, int iLine); |
371 | void SetHErrnoFromWinError(long lWinError); | 373 | void SetErrnoFromWinsockError (long lWinError); |
372 | void SetErrnoFromHRESULT(HRESULT hRes); | 374 | void SetHErrnoFromWinError (long lWinError); |
373 | int GetErrnoFromWinsockError(long lWinError); | 375 | void SetErrnoFromHRESULT (HRESULT hRes); |
374 | FILE *_win_fopen(const char *filename, const char *mode); | 376 | int GetErrnoFromWinsockError (long lWinError); |
375 | DIR *_win_opendir(const char *dirname); | 377 | FILE *_win_fopen (const char *filename, const char *mode); |
376 | int _win_open(const char *filename, int oflag, ...); | 378 | DIR *_win_opendir (const char *dirname); |
379 | int _win_open (const char *filename, int oflag, ...); | ||
377 | #ifdef ENABLE_NLS | 380 | #ifdef ENABLE_NLS |
378 | char *_win_bindtextdomain(const char *domainname, const char *dirname); | 381 | char *_win_bindtextdomain (const char *domainname, const char *dirname); |
379 | #endif | 382 | #endif |
380 | int _win_chdir(const char *path); | 383 | int _win_chdir (const char *path); |
381 | int _win_close(int fd); | 384 | int _win_close (int fd); |
382 | int _win_creat(const char *path, mode_t mode); | 385 | int _win_creat (const char *path, mode_t mode); |
383 | char *_win_ctime(const time_t *clock); | 386 | char *_win_ctime (const time_t * clock); |
384 | char *_win_ctime_r(const time_t *clock, char *buf); | 387 | char *_win_ctime_r (const time_t * clock, char *buf); |
385 | int _win_fstat(int handle, struct stat *buffer); | 388 | int _win_fstat (int handle, struct stat *buffer); |
386 | int _win_ftruncate(int fildes, off_t length); | 389 | int _win_ftruncate (int fildes, off_t length); |
387 | void _win_gettimeofday(struct timeval *tp, void *tzp); | 390 | void _win_gettimeofday (struct timeval *tp, void *tzp); |
388 | int _win_kill(pid_t pid, int sig); | 391 | int _win_kill (pid_t pid, int sig); |
389 | int _win_pipe(int *phandles); | 392 | int _win_pipe (int *phandles); |
390 | int _win_rmdir(const char *path); | 393 | int _win_rmdir (const char *path); |
391 | int _win_access( const char *path, int mode ); | 394 | int _win_access (const char *path, int mode); |
392 | int _win_chmod(const char *filename, int pmode); | 395 | int _win_chmod (const char *filename, int pmode); |
393 | char *realpath(const char *file_name, char *resolved_name); | 396 | char *realpath (const char *file_name, char *resolved_name); |
394 | long _win_random(void); | 397 | long _win_random (void); |
395 | void _win_srandom(unsigned int seed); | 398 | void _win_srandom (unsigned int seed); |
396 | int _win_remove(const char *path); | 399 | int _win_remove (const char *path); |
397 | int _win_rename(const char *oldname, const char *newname); | 400 | int _win_rename (const char *oldname, const char *newname); |
398 | int _win_stat(const char *path, struct stat *buffer); | 401 | int _win_stat (const char *path, struct stat *buffer); |
399 | int _win_stat64(const char *path, struct stat64 *buffer); | 402 | int _win_stat64 (const char *path, struct stat64 *buffer); |
400 | long _win_sysconf(int name); | 403 | long _win_sysconf (int name); |
401 | int _win_unlink(const char *filename); | 404 | int _win_unlink (const char *filename); |
402 | int _win_write(int fildes, const void *buf, size_t nbyte); | 405 | int _win_write (int fildes, const void *buf, size_t nbyte); |
403 | int _win_read(int fildes, void *buf, size_t nbyte); | 406 | int _win_read (int fildes, void *buf, size_t nbyte); |
404 | size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE *stream); | 407 | size_t _win_fwrite (const void *buffer, size_t size, size_t count, |
405 | size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream ); | 408 | FILE * stream); |
406 | int _win_symlink(const char *path1, const char *path2); | 409 | size_t _win_fread (void *buffer, size_t size, size_t count, FILE * stream); |
407 | void *_win_mmap(void *start, size_t len, int access, int flags, int fd, | 410 | int _win_symlink (const char *path1, const char *path2); |
408 | unsigned long long offset); | 411 | void *_win_mmap (void *start, size_t len, int access, int flags, int fd, |
409 | int _win_munmap(void *start, size_t length); | 412 | unsigned long long offset); |
410 | int _win_lstat(const char *path, struct stat *buf); | 413 | int _win_munmap (void *start, size_t length); |
411 | int _win_lstat64(const char *path, struct stat64 *buf); | 414 | int _win_lstat (const char *path, struct stat *buf); |
412 | int _win_readlink(const char *path, char *buf, size_t bufsize); | 415 | int _win_lstat64 (const char *path, struct stat64 *buf); |
413 | int _win_accept(int s, struct sockaddr *addr, int *addrlen); | 416 | int _win_readlink (const char *path, char *buf, size_t bufsize); |
414 | int _win_printf(const char *format,...); | 417 | int _win_accept (int s, struct sockaddr *addr, int *addrlen); |
415 | int _win_fprintf(FILE *f,const char *format,...); | 418 | int _win_printf (const char *format, ...); |
416 | int _win_vprintf(const char *format, va_list ap); | 419 | int _win_fprintf (FILE * f, const char *format, ...); |
417 | int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); | 420 | int _win_vprintf (const char *format, va_list ap); |
418 | int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); | 421 | int _win_vfprintf (FILE * stream, const char *format, va_list arg_ptr); |
419 | int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); | 422 | int _win_vsprintf (char *dest, const char *format, va_list arg_ptr); |
420 | int _win_snprintf(char *str,size_t size,const char *format,...); | 423 | int _win_vsnprintf (char *str, size_t size, const char *format, |
421 | int _win_sprintf(char *dest,const char *format,...); | 424 | va_list arg_ptr); |
422 | int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); | 425 | int _win_snprintf (char *str, size_t size, const char *format, ...); |
423 | int _win_sscanf(const char *str, const char *format, ...); | 426 | int _win_sprintf (char *dest, const char *format, ...); |
424 | int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); | 427 | int _win_vsscanf (const char *str, const char *format, va_list arg_ptr); |
425 | int _win_vscanf(const char *format, va_list arg_ptr); | 428 | int _win_sscanf (const char *str, const char *format, ...); |
426 | int _win_scanf(const char *format, ...); | 429 | int _win_vfscanf (FILE * stream, const char *format, va_list arg_ptr); |
427 | int _win_fscanf(FILE *stream, const char *format, ...); | 430 | int _win_vscanf (const char *format, va_list arg_ptr); |
428 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); | 431 | int _win_scanf (const char *format, ...); |
429 | int _win_bind(int s, const struct sockaddr *name, int namelen); | 432 | int _win_fscanf (FILE * stream, const char *format, ...); |
430 | int _win_connect(int s,const struct sockaddr *name, int namelen); | 433 | pid_t _win_waitpid (pid_t pid, int *stat_loc, int options); |
431 | int _win_getpeername(int s, struct sockaddr *name, | 434 | int _win_bind (int s, const struct sockaddr *name, int namelen); |
432 | int *namelen); | 435 | int _win_connect (int s, const struct sockaddr *name, int namelen); |
433 | int _win_getsockname(int s, struct sockaddr *name, | 436 | int _win_getpeername (int s, struct sockaddr *name, int *namelen); |
434 | int *namelen); | 437 | int _win_getsockname (int s, struct sockaddr *name, int *namelen); |
435 | int _win_getsockopt(int s, int level, int optname, char *optval, | 438 | int _win_getsockopt (int s, int level, int optname, char *optval, |
436 | int *optlen); | 439 | int *optlen); |
437 | int _win_listen(int s, int backlog); | 440 | int _win_listen (int s, int backlog); |
438 | int _win_recv(int s, char *buf, int len, int flags); | 441 | int _win_recv (int s, char *buf, int len, int flags); |
439 | int _win_recvfrom(int s, void *buf, int len, int flags, | 442 | int _win_recvfrom (int s, void *buf, int len, int flags, |
440 | struct sockaddr *from, int *fromlen); | 443 | struct sockaddr *from, int *fromlen); |
441 | int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, | 444 | int _win_select (int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, |
442 | const struct timeval *tv); | 445 | const struct timeval *tv); |
443 | int _win_send(int s, const char *buf, int len, int flags); | 446 | int _win_send (int s, const char *buf, int len, int flags); |
444 | int _win_sendto(int s, const char *buf, int len, int flags, | 447 | int _win_sendto (int s, const char *buf, int len, int flags, |
445 | const struct sockaddr *to, int tolen); | 448 | const struct sockaddr *to, int tolen); |
446 | int _win_setsockopt(int s, int level, int optname, const void *optval, | 449 | int _win_setsockopt (int s, int level, int optname, const void *optval, |
447 | int optlen); | 450 | int optlen); |
448 | int _win_shutdown(int s, int how); | 451 | int _win_shutdown (int s, int how); |
449 | int _win_socket(int af, int type, int protocol); | 452 | int _win_socket (int af, int type, int protocol); |
450 | struct hostent *_win_gethostbyaddr(const char *addr, int len, int type); | 453 | struct hostent *_win_gethostbyaddr (const char *addr, int len, int type); |
451 | struct hostent *_win_gethostbyname(const char *name); | 454 | struct hostent *_win_gethostbyname (const char *name); |
452 | struct hostent *gethostbyname2(const char *name, int af); | 455 | struct hostent *gethostbyname2 (const char *name, int af); |
453 | char *_win_strerror(int errnum); | 456 | char *_win_strerror (int errnum); |
454 | int IsWinNT(); | 457 | int IsWinNT (); |
455 | char *index(const char *s, int c); | 458 | char *index (const char *s, int c); |
456 | 459 | ||
457 | #if !HAVE_STRNDUP | 460 | #if !HAVE_STRNDUP |
458 | char *strndup (const char *s, size_t n); | 461 | char *strndup (const char *s, size_t n); |
459 | #endif | 462 | #endif |
460 | #if !HAVE_STRNLEN | 463 | #if !HAVE_STRNLEN |
461 | size_t strnlen (const char *str, size_t maxlen); | 464 | size_t strnlen (const char *str, size_t maxlen); |
462 | #endif | 465 | #endif |
463 | char *stpcpy(char *dest, const char *src); | 466 | char *stpcpy (char *dest, const char *src); |
464 | char *strcasestr(const char *haystack_start, const char *needle_start); | 467 | char *strcasestr (const char *haystack_start, const char *needle_start); |
465 | 468 | ||
466 | #define strcasecmp(a, b) stricmp(a, b) | 469 | #define strcasecmp(a, b) stricmp(a, b) |
467 | #define strncasecmp(a, b, c) strnicmp(a, b, c) | 470 | #define strncasecmp(a, b, c) strnicmp(a, b, c) |
468 | 471 | ||
469 | #endif /* WINDOWS */ | 472 | #endif /* WINDOWS */ |
470 | 473 | ||
471 | #ifndef WINDOWS | 474 | #ifndef WINDOWS |
472 | #define DIR_SEPARATOR '/' | 475 | #define DIR_SEPARATOR '/' |
473 | #define DIR_SEPARATOR_STR "/" | 476 | #define DIR_SEPARATOR_STR "/" |
474 | #define PATH_SEPARATOR ':' | 477 | #define PATH_SEPARATOR ':' |
475 | #define PATH_SEPARATOR_STR ":" | 478 | #define PATH_SEPARATOR_STR ":" |
476 | #define NEWLINE "\n" | 479 | #define NEWLINE "\n" |
477 | 480 | ||
478 | #ifdef ENABLE_NLS | 481 | #ifdef ENABLE_NLS |
479 | #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) | 482 | #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) |
480 | #endif | 483 | #endif |
481 | #define CREAT(p, m) creat(p, m) | 484 | #define CREAT(p, m) creat(p, m) |
482 | #define PLIBC_CTIME(c) ctime(c) | 485 | #define PLIBC_CTIME(c) ctime(c) |
483 | #define CTIME_R(c, b) ctime_r(c, b) | 486 | #define CTIME_R(c, b) ctime_r(c, b) |
484 | #undef FOPEN | 487 | #undef FOPEN |
485 | #define FOPEN(f, m) fopen(f, m) | 488 | #define FOPEN(f, m) fopen(f, m) |
486 | #define FTRUNCATE(f, l) ftruncate(f, l) | 489 | #define FTRUNCATE(f, l) ftruncate(f, l) |
487 | #define OPENDIR(d) opendir(d) | 490 | #define OPENDIR(d) opendir(d) |
488 | #define OPEN open | 491 | #define OPEN open |
489 | #define CHDIR(d) chdir(d) | 492 | #define CHDIR(d) chdir(d) |
490 | #define CLOSE(f) close(f) | 493 | #define CLOSE(f) close(f) |
491 | #define LSEEK(f, o, w) lseek(f, o, w) | 494 | #define LSEEK(f, o, w) lseek(f, o, w) |
492 | #define RMDIR(f) rmdir(f) | 495 | #define RMDIR(f) rmdir(f) |
493 | #define ACCESS(p, m) access(p, m) | 496 | #define ACCESS(p, m) access(p, m) |
494 | #define CHMOD(f, p) chmod(f, p) | 497 | #define CHMOD(f, p) chmod(f, p) |
495 | #define FSTAT(h, b) fstat(h, b) | 498 | #define FSTAT(h, b) fstat(h, b) |
496 | #define PLIBC_KILL(p, s) kill(p, s) | 499 | #define PLIBC_KILL(p, s) kill(p, s) |
497 | #define PIPE(h) pipe(h) | 500 | #define PIPE(h) pipe(h) |
498 | #define REMOVE(p) remove(p) | 501 | #define REMOVE(p) remove(p) |
499 | #define RENAME(o, n) rename(o, n) | 502 | #define RENAME(o, n) rename(o, n) |
500 | #define STAT(p, b) stat(p, b) | 503 | #define STAT(p, b) stat(p, b) |
501 | #define STAT64(p, b) stat64(p, b) | 504 | #define STAT64(p, b) stat64(p, b) |
502 | #define SYSCONF(n) sysconf(n) | 505 | #define SYSCONF(n) sysconf(n) |
503 | #define UNLINK(f) unlink(f) | 506 | #define UNLINK(f) unlink(f) |
504 | #define WRITE(f, b, n) write(f, b, n) | 507 | #define WRITE(f, b, n) write(f, b, n) |
505 | #define READ(f, b, n) read(f, b, n) | 508 | #define READ(f, b, n) read(f, b, n) |
506 | #define GN_FREAD(b, s, c, f) fread(b, s, c, f) | 509 | #define GN_FREAD(b, s, c, f) fread(b, s, c, f) |
507 | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) | 510 | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) |
508 | #define SYMLINK(a, b) symlink(a, b) | 511 | #define SYMLINK(a, b) symlink(a, b) |
509 | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) | 512 | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) |
510 | #define MUNMAP(s, l) munmap(s, l) | 513 | #define MUNMAP(s, l) munmap(s, l) |
511 | #define STRERROR(i) strerror(i) | 514 | #define STRERROR(i) strerror(i) |
512 | #define RANDOM() random() | 515 | #define RANDOM() random() |
513 | #define SRANDOM(s) srandom(s) | 516 | #define SRANDOM(s) srandom(s) |
514 | #define READLINK(p, b, s) readlink(p, b, s) | 517 | #define READLINK(p, b, s) readlink(p, b, s) |
515 | #define LSTAT(p, b) lstat(p, b) | 518 | #define LSTAT(p, b) lstat(p, b) |
516 | #define LSTAT64(p, b) lstat64(p, b) | 519 | #define LSTAT64(p, b) lstat64(p, b) |
517 | #define PRINTF printf | 520 | #define PRINTF printf |
518 | #define FPRINTF fprintf | 521 | #define FPRINTF fprintf |
519 | #define VPRINTF(f, a) vprintf(f, a) | 522 | #define VPRINTF(f, a) vprintf(f, a) |
520 | #define VFPRINTF(s, f, a) vfprintf(s, f, a) | 523 | #define VFPRINTF(s, f, a) vfprintf(s, f, a) |
521 | #define VSPRINTF(d, f, a) vsprintf(d, f, a) | 524 | #define VSPRINTF(d, f, a) vsprintf(d, f, a) |
522 | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) | 525 | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) |
523 | #define _REAL_SNPRINTF snprintf | 526 | #define _REAL_SNPRINTF snprintf |
524 | #define SPRINTF sprintf | 527 | #define SPRINTF sprintf |
525 | #define VSSCANF(s, f, a) vsscanf(s, f, a) | 528 | #define VSSCANF(s, f, a) vsscanf(s, f, a) |
526 | #define SSCANF sscanf | 529 | #define SSCANF sscanf |
527 | #define VFSCANF(s, f, a) vfscanf(s, f, a) | 530 | #define VFSCANF(s, f, a) vfscanf(s, f, a) |
528 | #define VSCANF(f, a) vscanf(f, a) | 531 | #define VSCANF(f, a) vscanf(f, a) |
529 | #define SCANF scanf | 532 | #define SCANF scanf |
530 | #define FSCANF fscanf | 533 | #define FSCANF fscanf |
531 | #define WAITPID(p, s, o) waitpid(p, s, o) | 534 | #define WAITPID(p, s, o) waitpid(p, s, o) |
532 | #define ACCEPT(s, a, l) accept(s, a, l) | 535 | #define ACCEPT(s, a, l) accept(s, a, l) |
533 | #define BIND(s, n, l) bind(s, n, l) | 536 | #define BIND(s, n, l) bind(s, n, l) |
534 | #define CONNECT(s, n, l) connect(s, n, l) | 537 | #define CONNECT(s, n, l) connect(s, n, l) |
535 | #define GETPEERNAME(s, n, l) getpeername(s, n, l) | 538 | #define GETPEERNAME(s, n, l) getpeername(s, n, l) |
536 | #define GETSOCKNAME(s, n, l) getsockname(s, n, l) | 539 | #define GETSOCKNAME(s, n, l) getsockname(s, n, l) |
537 | #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) | 540 | #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) |
538 | #define LISTEN(s, b) listen(s, b) | 541 | #define LISTEN(s, b) listen(s, b) |
539 | #define RECV(s, b, l, f) recv(s, b, l, f) | 542 | #define RECV(s, b, l, f) recv(s, b, l, f) |
540 | #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) | 543 | #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) |
541 | #define SELECT(n, r, w, e, t) select(n, r, w, e, t) | 544 | #define SELECT(n, r, w, e, t) select(n, r, w, e, t) |
542 | #define SEND(s, b, l, f) send(s, b, l, f) | 545 | #define SEND(s, b, l, f) send(s, b, l, f) |
543 | #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) | 546 | #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) |
544 | #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) | 547 | #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) |
545 | #define SHUTDOWN(s, h) shutdown(s, h) | 548 | #define SHUTDOWN(s, h) shutdown(s, h) |
546 | #define SOCKET(a, t, p) socket(a, t, p) | 549 | #define SOCKET(a, t, p) socket(a, t, p) |
547 | #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) | 550 | #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) |
548 | #define GETHOSTBYNAME(n) gethostbyname(n) | 551 | #define GETHOSTBYNAME(n) gethostbyname(n) |
549 | #define GETTIMEOFDAY(t, n) gettimeofday(t, n) | 552 | #define GETTIMEOFDAY(t, n) gettimeofday(t, n) |
550 | #define INSQUE(e, p) insque(e, p) | 553 | #define INSQUE(e, p) insque(e, p) |
551 | #define REMQUE(e) remque(e) | 554 | #define REMQUE(e) remque(e) |
552 | #define HSEARCH(i, a) hsearch(i, a) | 555 | #define HSEARCH(i, a) hsearch(i, a) |
553 | #define HCREATE(n) hcreate(n) | 556 | #define HCREATE(n) hcreate(n) |
554 | #define HDESTROY() hdestroy() | 557 | #define HDESTROY() hdestroy() |
555 | #define HSEARCH_R(i, a, r, h) hsearch_r(i, a, r, h) | 558 | #define HSEARCH_R(i, a, r, h) hsearch_r(i, a, r, h) |
556 | #define HCREATE_R(n, h) hcreate_r(n, h) | 559 | #define HCREATE_R(n, h) hcreate_r(n, h) |
557 | #define HDESTROY_R(h) hdestroy_r(h) | 560 | #define HDESTROY_R(h) hdestroy_r(h) |
558 | #define TSEARCH(k, r, c) tsearch(k, r, c) | 561 | #define TSEARCH(k, r, c) tsearch(k, r, c) |
559 | #define TFIND(k, r, c) tfind(k, r, c) | 562 | #define TFIND(k, r, c) tfind(k, r, c) |
560 | #define TDELETE(k, r, c) tdelete(k, r, c) | 563 | #define TDELETE(k, r, c) tdelete(k, r, c) |
561 | #define TWALK(r, a) twalk(r, a) | 564 | #define TWALK(r, a) twalk(r, a) |
562 | #define TDESTROY(r, f) tdestroy(r, f) | 565 | #define TDESTROY(r, f) tdestroy(r, f) |
563 | #define LFIND(k, b, n, s, c) lfind(k, b, n, s, c) | 566 | #define LFIND(k, b, n, s, c) lfind(k, b, n, s, c) |
564 | #define LSEARCH(k, b, n, s, c) lsearch(k, b, n, s, c) | 567 | #define LSEARCH(k, b, n, s, c) lsearch(k, b, n, s, c) |
565 | #else | 568 | #else |
566 | #define DIR_SEPARATOR '\\' | 569 | #define DIR_SEPARATOR '\\' |
567 | #define DIR_SEPARATOR_STR "\\" | 570 | #define DIR_SEPARATOR_STR "\\" |
568 | #define PATH_SEPARATOR ';' | 571 | #define PATH_SEPARATOR ';' |
569 | #define PATH_SEPARATOR_STR ";" | 572 | #define PATH_SEPARATOR_STR ";" |
570 | #define NEWLINE "\r\n" | 573 | #define NEWLINE "\r\n" |
571 | 574 | ||
572 | #ifdef ENABLE_NLS | 575 | #ifdef ENABLE_NLS |
573 | #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) | 576 | #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) |
574 | #endif | 577 | #endif |
575 | #define CREAT(p, m) _win_creat(p, m) | 578 | #define CREAT(p, m) _win_creat(p, m) |
576 | #define PLIBC_CTIME(c) _win_ctime(c) | 579 | #define PLIBC_CTIME(c) _win_ctime(c) |
577 | #define CTIME_R(c, b) _win_ctime_r(c, b) | 580 | #define CTIME_R(c, b) _win_ctime_r(c, b) |
578 | #define FOPEN(f, m) _win_fopen(f, m) | 581 | #define FOPEN(f, m) _win_fopen(f, m) |
579 | #define FTRUNCATE(f, l) _win_ftruncate(f, l) | 582 | #define FTRUNCATE(f, l) _win_ftruncate(f, l) |
580 | #define OPENDIR(d) _win_opendir(d) | 583 | #define OPENDIR(d) _win_opendir(d) |
581 | #define OPEN _win_open | 584 | #define OPEN _win_open |
582 | #define CHDIR(d) _win_chdir(d) | 585 | #define CHDIR(d) _win_chdir(d) |
583 | #define CLOSE(f) _win_close(f) | 586 | #define CLOSE(f) _win_close(f) |
584 | #define PLIBC_KILL(p, s) _win_kill(p, s) | 587 | #define PLIBC_KILL(p, s) _win_kill(p, s) |
585 | #define LSEEK(f, o, w) _win_lseek(f, o, w) | 588 | #define LSEEK(f, o, w) _win_lseek(f, o, w) |
586 | #define FSTAT(h, b) _win_fstat(h, b) | 589 | #define FSTAT(h, b) _win_fstat(h, b) |
587 | #define RMDIR(f) _win_rmdir(f) | 590 | #define RMDIR(f) _win_rmdir(f) |
588 | #define ACCESS(p, m) _win_access(p, m) | 591 | #define ACCESS(p, m) _win_access(p, m) |
589 | #define CHMOD(f, p) _win_chmod(f, p) | 592 | #define CHMOD(f, p) _win_chmod(f, p) |
590 | #define PIPE(h) _win_pipe(h) | 593 | #define PIPE(h) _win_pipe(h) |
591 | #define RANDOM() _win_random() | 594 | #define RANDOM() _win_random() |
592 | #define SRANDOM(s) _win_srandom(s) | 595 | #define SRANDOM(s) _win_srandom(s) |
593 | #define REMOVE(p) _win_remove(p) | 596 | #define REMOVE(p) _win_remove(p) |
594 | #define RENAME(o, n) _win_rename(o, n) | 597 | #define RENAME(o, n) _win_rename(o, n) |
595 | #define STAT(p, b) _win_stat(p, b) | 598 | #define STAT(p, b) _win_stat(p, b) |
596 | #define STAT64(p, b) _win_stat64(p, b) | 599 | #define STAT64(p, b) _win_stat64(p, b) |
597 | #define SYSCONF(n) _win_sysconf(n) | 600 | #define SYSCONF(n) _win_sysconf(n) |
598 | #define UNLINK(f) _win_unlink(f) | 601 | #define UNLINK(f) _win_unlink(f) |
599 | #define WRITE(f, b, n) _win_write(f, b, n) | 602 | #define WRITE(f, b, n) _win_write(f, b, n) |
600 | #define READ(f, b, n) _win_read(f, b, n) | 603 | #define READ(f, b, n) _win_read(f, b, n) |
601 | #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) | 604 | #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) |
602 | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) | 605 | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) |
603 | #define SYMLINK(a, b) _win_symlink(a, b) | 606 | #define SYMLINK(a, b) _win_symlink(a, b) |
604 | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) | 607 | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) |
605 | #define MUNMAP(s, l) _win_munmap(s, l) | 608 | #define MUNMAP(s, l) _win_munmap(s, l) |
606 | #define STRERROR(i) _win_strerror(i) | 609 | #define STRERROR(i) _win_strerror(i) |
607 | #define READLINK(p, b, s) _win_readlink(p, b, s) | 610 | #define READLINK(p, b, s) _win_readlink(p, b, s) |
608 | #define LSTAT(p, b) _win_lstat(p, b) | 611 | #define LSTAT(p, b) _win_lstat(p, b) |
609 | #define LSTAT64(p, b) _win_lstat64(p, b) | 612 | #define LSTAT64(p, b) _win_lstat64(p, b) |
610 | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) | 613 | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) |
611 | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) | 614 | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) |
612 | #define VPRINTF(f, a) _win_vprintf(f, a) | 615 | #define VPRINTF(f, a) _win_vprintf(f, a) |
613 | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) | 616 | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) |
614 | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) | 617 | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) |
615 | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) | 618 | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) |
616 | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) | 619 | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) |
617 | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) | 620 | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) |
618 | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) | 621 | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) |
619 | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) | 622 | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) |
620 | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) | 623 | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) |
621 | #define VSCANF(f, a) _win_vscanf(f, a) | 624 | #define VSCANF(f, a) _win_vscanf(f, a) |
622 | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) | 625 | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) |
623 | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) | 626 | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) |
624 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) | 627 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) |
625 | #define ACCEPT(s, a, l) _win_accept(s, a, l) | 628 | #define ACCEPT(s, a, l) _win_accept(s, a, l) |
626 | #define BIND(s, n, l) _win_bind(s, n, l) | 629 | #define BIND(s, n, l) _win_bind(s, n, l) |
627 | #define CONNECT(s, n, l) _win_connect(s, n, l) | 630 | #define CONNECT(s, n, l) _win_connect(s, n, l) |
628 | #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) | 631 | #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) |
629 | #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) | 632 | #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) |
630 | #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) | 633 | #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) |
631 | #define LISTEN(s, b) _win_listen(s, b) | 634 | #define LISTEN(s, b) _win_listen(s, b) |
632 | #define RECV(s, b, l, f) _win_recv(s, b, l, f) | 635 | #define RECV(s, b, l, f) _win_recv(s, b, l, f) |
633 | #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) | 636 | #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) |
634 | #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) | 637 | #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) |
635 | #define SEND(s, b, l, f) _win_send(s, b, l, f) | 638 | #define SEND(s, b, l, f) _win_send(s, b, l, f) |
636 | #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) | 639 | #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) |
637 | #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) | 640 | #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) |
638 | #define SHUTDOWN(s, h) _win_shutdown(s, h) | 641 | #define SHUTDOWN(s, h) _win_shutdown(s, h) |
639 | #define SOCKET(a, t, p) _win_socket(a, t, p) | 642 | #define SOCKET(a, t, p) _win_socket(a, t, p) |
640 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) | 643 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) |
641 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) | 644 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) |
642 | #define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n) | 645 | #define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n) |
643 | #define INSQUE(e, p) _win_insque(e, p) | 646 | #define INSQUE(e, p) _win_insque(e, p) |
644 | #define REMQUE(e) _win_remque(e) | 647 | #define REMQUE(e) _win_remque(e) |
645 | #define HSEARCH(i, a) _win_hsearch(i, a) | 648 | #define HSEARCH(i, a) _win_hsearch(i, a) |
646 | #define HCREATE(n) _win_hcreate(n) | 649 | #define HCREATE(n) _win_hcreate(n) |
647 | #define HDESTROY() _win_hdestroy() | 650 | #define HDESTROY() _win_hdestroy() |
648 | #define HSEARCH_R(i, a, r, h) _win_hsearch_r(i, a, r, h) | 651 | #define HSEARCH_R(i, a, r, h) _win_hsearch_r(i, a, r, h) |
649 | #define HCREATE_R(n, h) _win_hcreate_r(n, h) | 652 | #define HCREATE_R(n, h) _win_hcreate_r(n, h) |
650 | #define HDESTROY_R(h) _win_hdestroy_r(h) | 653 | #define HDESTROY_R(h) _win_hdestroy_r(h) |
651 | #define TSEARCH(k, r, c) _win_tsearch(k, r, c) | 654 | #define TSEARCH(k, r, c) _win_tsearch(k, r, c) |
652 | #define TFIND(k, r, c) _win_tfind(k, r, c) | 655 | #define TFIND(k, r, c) _win_tfind(k, r, c) |
653 | #define TDELETE(k, r, c) _win_tdelete(k, r, c) | 656 | #define TDELETE(k, r, c) _win_tdelete(k, r, c) |
654 | #define TWALK(r, a) _win_twalk(r, a) | 657 | #define TWALK(r, a) _win_twalk(r, a) |
655 | #define TDESTROY(r, f) _win_tdestroy(r, f) | 658 | #define TDESTROY(r, f) _win_tdestroy(r, f) |
656 | #define LFIND(k, b, n, s, c) _win_lfind(k, b, n, s, c) | 659 | #define LFIND(k, b, n, s, c) _win_lfind(k, b, n, s, c) |
657 | #define LSEARCH(k, b, n, s, c) _win_lsearch(k, b, n, s, c) | 660 | #define LSEARCH(k, b, n, s, c) _win_lsearch(k, b, n, s, c) |
658 | #endif | 661 | #endif |
659 | 662 | ||
660 | /* search.h */ | 663 | /* search.h */ |
@@ -662,7 +665,7 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
662 | /* Prototype structure for a linked-list data structure. | 665 | /* Prototype structure for a linked-list data structure. |
663 | This is the type used by the `insque' and `remque' functions. */ | 666 | This is the type used by the `insque' and `remque' functions. */ |
664 | 667 | ||
665 | struct PLIBC_SEARCH_QELEM | 668 | struct PLIBC_SEARCH_QELEM |
666 | { | 669 | { |
667 | struct qelem *q_forw; | 670 | struct qelem *q_forw; |
668 | struct qelem *q_back; | 671 | struct qelem *q_back; |
@@ -671,41 +674,41 @@ struct PLIBC_SEARCH_QELEM | |||
671 | 674 | ||
672 | 675 | ||
673 | /* Insert ELEM into a doubly-linked list, after PREV. */ | 676 | /* Insert ELEM into a doubly-linked list, after PREV. */ |
674 | void _win_insque (void *__elem, void *__prev); | 677 | void _win_insque (void *__elem, void *__prev); |
675 | 678 | ||
676 | /* Unlink ELEM from the doubly-linked list that it is in. */ | 679 | /* Unlink ELEM from the doubly-linked list that it is in. */ |
677 | void _win_remque (void *__elem); | 680 | void _win_remque (void *__elem); |
678 | 681 | ||
679 | 682 | ||
680 | /* For use with hsearch(3). */ | 683 | /* For use with hsearch(3). */ |
681 | typedef int (*PLIBC_SEARCH__compar_fn_t) (__const void *, __const void *); | 684 | typedef int (*PLIBC_SEARCH__compar_fn_t) (__const void *, __const void *); |
682 | 685 | ||
683 | typedef PLIBC_SEARCH__compar_fn_t _win_comparison_fn_t; | 686 | typedef PLIBC_SEARCH__compar_fn_t _win_comparison_fn_t; |
684 | 687 | ||
685 | /* Action which shall be performed in the call the hsearch. */ | 688 | /* Action which shall be performed in the call the hsearch. */ |
686 | typedef enum | 689 | typedef enum |
687 | { | 690 | { |
688 | PLIBC_SEARCH_FIND, | 691 | PLIBC_SEARCH_FIND, |
689 | PLIBC_SEARCH_ENTER | 692 | PLIBC_SEARCH_ENTER |
690 | } | 693 | } |
691 | PLIBC_SEARCH_ACTION; | 694 | PLIBC_SEARCH_ACTION; |
692 | 695 | ||
693 | typedef struct PLIBC_SEARCH_entry | 696 | typedef struct PLIBC_SEARCH_entry |
694 | { | 697 | { |
695 | char *key; | 698 | char *key; |
696 | void *data; | 699 | void *data; |
697 | } | 700 | } |
698 | PLIBC_SEARCH_ENTRY; | 701 | PLIBC_SEARCH_ENTRY; |
699 | 702 | ||
700 | /* The reentrant version has no static variables to maintain the state. | 703 | /* The reentrant version has no static variables to maintain the state. |
701 | Instead the interface of all functions is extended to take an argument | 704 | Instead the interface of all functions is extended to take an argument |
702 | which describes the current status. */ | 705 | which describes the current status. */ |
703 | typedef struct _PLIBC_SEARCH_ENTRY | 706 | typedef struct _PLIBC_SEARCH_ENTRY |
704 | { | 707 | { |
705 | unsigned int used; | 708 | unsigned int used; |
706 | PLIBC_SEARCH_ENTRY entry; | 709 | PLIBC_SEARCH_ENTRY entry; |
707 | } | 710 | } |
708 | _PLIBC_SEARCH_ENTRY; | 711 | _PLIBC_SEARCH_ENTRY; |
709 | 712 | ||
710 | 713 | ||
711 | /* Family of hash table handling functions. The functions also | 714 | /* Family of hash table handling functions. The functions also |
@@ -716,16 +719,17 @@ _PLIBC_SEARCH_ENTRY; | |||
716 | ACTION is `FIND' return found entry or signal error by returning | 719 | ACTION is `FIND' return found entry or signal error by returning |
717 | NULL. If ACTION is `ENTER' replace existing data (if any) with | 720 | NULL. If ACTION is `ENTER' replace existing data (if any) with |
718 | ITEM.data. */ | 721 | ITEM.data. */ |
719 | PLIBC_SEARCH_ENTRY *_win_hsearch (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action); | 722 | PLIBC_SEARCH_ENTRY *_win_hsearch (PLIBC_SEARCH_ENTRY __item, |
723 | PLIBC_SEARCH_ACTION __action); | ||
720 | 724 | ||
721 | /* Create a new hashing table which will at most contain NEL elements. */ | 725 | /* Create a new hashing table which will at most contain NEL elements. */ |
722 | int _win_hcreate (size_t __nel); | 726 | int _win_hcreate (size_t __nel); |
723 | 727 | ||
724 | /* Destroy current internal hashing table. */ | 728 | /* Destroy current internal hashing table. */ |
725 | void _win_hdestroy (void); | 729 | void _win_hdestroy (void); |
726 | 730 | ||
727 | /* Data type for reentrant functions. */ | 731 | /* Data type for reentrant functions. */ |
728 | struct PLIBC_SEARCH_hsearch_data | 732 | struct PLIBC_SEARCH_hsearch_data |
729 | { | 733 | { |
730 | struct _PLIBC_SEARCH_ENTRY *table; | 734 | struct _PLIBC_SEARCH_ENTRY *table; |
731 | unsigned int size; | 735 | unsigned int size; |
@@ -734,10 +738,11 @@ struct PLIBC_SEARCH_hsearch_data | |||
734 | 738 | ||
735 | /* Reentrant versions which can handle multiple hashing tables at the | 739 | /* Reentrant versions which can handle multiple hashing tables at the |
736 | same time. */ | 740 | same time. */ |
737 | int _win_hsearch_r (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action, PLIBC_SEARCH_ENTRY **__retval, | 741 | int _win_hsearch_r (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action, |
738 | struct PLIBC_SEARCH_hsearch_data *__htab); | 742 | PLIBC_SEARCH_ENTRY ** __retval, |
739 | int _win_hcreate_r (size_t __nel, struct PLIBC_SEARCH_hsearch_data *__htab); | 743 | struct PLIBC_SEARCH_hsearch_data *__htab); |
740 | void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab); | 744 | int _win_hcreate_r (size_t __nel, struct PLIBC_SEARCH_hsearch_data *__htab); |
745 | void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab); | ||
741 | 746 | ||
742 | 747 | ||
743 | /* The tsearch routines are very interesting. They make many | 748 | /* The tsearch routines are very interesting. They make many |
@@ -745,54 +750,57 @@ void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab); | |||
745 | in node must be the "key" field, which points to the datum. | 750 | in node must be the "key" field, which points to the datum. |
746 | Everything depends on that. */ | 751 | Everything depends on that. */ |
747 | /* For tsearch */ | 752 | /* For tsearch */ |
748 | typedef enum | 753 | typedef enum |
749 | { | 754 | { |
750 | PLIBC_SEARCH_preorder, | 755 | PLIBC_SEARCH_preorder, |
751 | PLIBC_SEARCH_postorder, | 756 | PLIBC_SEARCH_postorder, |
752 | PLIBC_SEARCH_endorder, | 757 | PLIBC_SEARCH_endorder, |
753 | PLIBC_SEARCH_leaf | 758 | PLIBC_SEARCH_leaf |
754 | } | 759 | } |
755 | PLIBC_SEARCH_VISIT; | 760 | PLIBC_SEARCH_VISIT; |
756 | 761 | ||
757 | /* Search for an entry matching the given KEY in the tree pointed to | 762 | /* Search for an entry matching the given KEY in the tree pointed to |
758 | by *ROOTP and insert a new element if not found. */ | 763 | by *ROOTP and insert a new element if not found. */ |
759 | void *_win_tsearch (__const void *__key, void **__rootp, | 764 | void *_win_tsearch (__const void *__key, void **__rootp, |
760 | PLIBC_SEARCH__compar_fn_t __compar); | 765 | PLIBC_SEARCH__compar_fn_t __compar); |
761 | 766 | ||
762 | /* Search for an entry matching the given KEY in the tree pointed to | 767 | /* Search for an entry matching the given KEY in the tree pointed to |
763 | by *ROOTP. If no matching entry is available return NULL. */ | 768 | by *ROOTP. If no matching entry is available return NULL. */ |
764 | void *_win_tfind (__const void *__key, void *__const *__rootp, | 769 | void *_win_tfind (__const void *__key, void *__const * __rootp, |
765 | PLIBC_SEARCH__compar_fn_t __compar); | 770 | PLIBC_SEARCH__compar_fn_t __compar); |
766 | 771 | ||
767 | /* Remove the element matching KEY from the tree pointed to by *ROOTP. */ | 772 | /* Remove the element matching KEY from the tree pointed to by *ROOTP. */ |
768 | void *_win_tdelete (__const void *__restrict __key, | 773 | void *_win_tdelete (__const void *__restrict __key, |
769 | void **__restrict __rootp, | 774 | void **__restrict __rootp, |
770 | PLIBC_SEARCH__compar_fn_t __compar); | 775 | PLIBC_SEARCH__compar_fn_t __compar); |
771 | 776 | ||
772 | typedef void (*PLIBC_SEARCH__action_fn_t) (__const void *__nodep, PLIBC_SEARCH_VISIT __value, | 777 | typedef void (*PLIBC_SEARCH__action_fn_t) (__const void *__nodep, |
773 | int __level); | 778 | PLIBC_SEARCH_VISIT __value, |
779 | int __level); | ||
774 | 780 | ||
775 | /* Walk through the whole tree and call the ACTION callback for every node | 781 | /* Walk through the whole tree and call the ACTION callback for every node |
776 | or leaf. */ | 782 | or leaf. */ |
777 | void _win_twalk (__const void *__root, PLIBC_SEARCH__action_fn_t __action); | 783 | void _win_twalk (__const void *__root, PLIBC_SEARCH__action_fn_t __action); |
778 | 784 | ||
779 | /* Callback type for function to free a tree node. If the keys are atomic | 785 | /* Callback type for function to free a tree node. If the keys are atomic |
780 | data this function should do nothing. */ | 786 | data this function should do nothing. */ |
781 | typedef void (*PLIBC_SEARCH__free_fn_t) (void *__nodep); | 787 | typedef void (*PLIBC_SEARCH__free_fn_t) (void *__nodep); |
782 | 788 | ||
783 | /* Destroy the whole tree, call FREEFCT for each node or leaf. */ | 789 | /* Destroy the whole tree, call FREEFCT for each node or leaf. */ |
784 | void _win_tdestroy (void *__root, PLIBC_SEARCH__free_fn_t __freefct); | 790 | void _win_tdestroy (void *__root, PLIBC_SEARCH__free_fn_t __freefct); |
785 | 791 | ||
786 | 792 | ||
787 | /* Perform linear search for KEY by comparing by COMPAR in an array | 793 | /* Perform linear search for KEY by comparing by COMPAR in an array |
788 | [BASE,BASE+NMEMB*SIZE). */ | 794 | [BASE,BASE+NMEMB*SIZE). */ |
789 | void *_win_lfind (__const void *__key, __const void *__base, | 795 | void *_win_lfind (__const void *__key, __const void *__base, |
790 | size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compar); | 796 | size_t * __nmemb, size_t __size, |
797 | PLIBC_SEARCH__compar_fn_t __compar); | ||
791 | 798 | ||
792 | /* Perform linear search for KEY by comparing by COMPAR function in | 799 | /* Perform linear search for KEY by comparing by COMPAR function in |
793 | array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */ | 800 | array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */ |
794 | void *_win_lsearch (__const void *__key, void *__base, | 801 | void *_win_lsearch (__const void *__key, void *__base, |
795 | size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compar); | 802 | size_t * __nmemb, size_t __size, |
803 | PLIBC_SEARCH__compar_fn_t __compar); | ||
796 | 804 | ||
797 | 805 | ||
798 | #ifdef __cplusplus | 806 | #ifdef __cplusplus |
@@ -800,6 +808,6 @@ void *_win_lsearch (__const void *__key, void *__base, | |||
800 | #endif | 808 | #endif |
801 | 809 | ||
802 | 810 | ||
803 | #endif //_PLIBC_H_ | 811 | #endif //_PLIBC_H_ |
804 | 812 | ||
805 | /* end of plibc.h */ | 813 | /* end of plibc.h */ |