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