diff options
Diffstat (limited to 'src/plibc.h')
-rw-r--r-- | src/plibc.h | 565 |
1 files changed, 565 insertions, 0 deletions
diff --git a/src/plibc.h b/src/plibc.h new file mode 100644 index 00000000..ab630526 --- /dev/null +++ b/src/plibc.h | |||
@@ -0,0 +1,565 @@ | |||
1 | /* | ||
2 | This file is part of PlibC. | ||
3 | (C) 2005 Nils Durner (and other contributing authors) | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | /** | ||
21 | * @file include/plibc.h | ||
22 | * @brief PlibC header | ||
23 | * @attention This file is usually not installed under Unix, | ||
24 | * so ship it with your application | ||
25 | * @version $Revision: 1.16 $ | ||
26 | */ | ||
27 | |||
28 | #ifndef _PLIBC_H_ | ||
29 | #define _PLIBC_H_ | ||
30 | |||
31 | #ifndef SIGALRM | ||
32 | #define SIGALRM 14 | ||
33 | #endif | ||
34 | |||
35 | #if ENABLE_NLS | ||
36 | #include "langinfo.h" | ||
37 | #endif | ||
38 | |||
39 | #ifdef __cplusplus | ||
40 | extern "C" { | ||
41 | #endif | ||
42 | |||
43 | #ifdef WINDOWS | ||
44 | |||
45 | #include <windows.h> | ||
46 | #include <time.h> | ||
47 | #include <stdio.h> | ||
48 | #include <sys/types.h> | ||
49 | #include <sys/stat.h> | ||
50 | #include <dirent.h> | ||
51 | |||
52 | #define __BYTE_ORDER BYTE_ORDER | ||
53 | #define __BIG_ENDIAN BIG_ENDIAN | ||
54 | |||
55 | /* Conflicts with our definitions */ | ||
56 | #define __G_WIN32_H__ | ||
57 | |||
58 | /* Convert LARGE_INTEGER to double */ | ||
59 | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ | ||
60 | (double)((x).LowPart)) | ||
61 | |||
62 | #define socklen_t int | ||
63 | #define ssize_t int | ||
64 | #define ftruncate chsize | ||
65 | #define off_t int | ||
66 | #define int64_t long long | ||
67 | #define int32_t long | ||
68 | |||
69 | /* Thanks to the Cygwin project */ | ||
70 | #define EPERM 1 /* Not super-user */ | ||
71 | #define ENOENT 2 /* No such file or directory */ | ||
72 | #define ESRCH 3 /* No such process */ | ||
73 | #define EINTR 4 /* Interrupted system call */ | ||
74 | #define EIO 5 /* I/O error */ | ||
75 | #define ENXIO 6 /* No such device or address */ | ||
76 | #define E2BIG 7 /* Arg list too long */ | ||
77 | #define ENOEXEC 8 /* Exec format error */ | ||
78 | #define EBADF 9 /* Bad file number */ | ||
79 | #define ECHILD 10 /* No children */ | ||
80 | #define EAGAIN 11 /* Resource unavailable or operation would block, try again */ | ||
81 | #define ENOMEM 12 /* Not enough memory */ | ||
82 | #define EACCES 13 /* Permission denied */ | ||
83 | #define EFAULT 14 /* Bad address */ | ||
84 | #define ENOTBLK 15 /* Block device required */ | ||
85 | #define EBUSY 16 /* Mount device busy */ | ||
86 | #define EEXIST 17 /* File exists */ | ||
87 | #define EXDEV 18 /* Cross-device link */ | ||
88 | #define ENODEV 19 /* No such device */ | ||
89 | #define ENOTDIR 20 /* Not a directory */ | ||
90 | #define EISDIR 21 /* Is a directory */ | ||
91 | #define EINVAL 22 /* Invalid argument */ | ||
92 | #define ENFILE 23 /* Too many open files in system */ | ||
93 | #define EMFILE 24 /* Too many open files */ | ||
94 | #define ENOTTY 25 /* Not a typewriter */ | ||
95 | #define ETXTBSY 26 /* Text file busy */ | ||
96 | #define EFBIG 27 /* File too large */ | ||
97 | #define ENOSPC 28 /* No space left on device */ | ||
98 | #define ESPIPE 29 /* Illegal seek */ | ||
99 | #define EROFS 30 /* Read only file system */ | ||
100 | #define EMLINK 31 /* Too many links */ | ||
101 | #define EPIPE 32 /* Broken pipe */ | ||
102 | #define EDOM 33 /* Math arg out of domain of func */ | ||
103 | #define ERANGE 34 /* Math result not representable */ | ||
104 | #define ENOMSG 35 /* No message of desired type */ | ||
105 | #define EIDRM 36 /* Identifier removed */ | ||
106 | #define ECHRNG 37 /* Channel number out of range */ | ||
107 | #define EL2NSYNC 38 /* Level 2 not synchronized */ | ||
108 | #define L3HLT 39 /* Level 3 halted */ | ||
109 | #define EL3RST 40 /* Level 3 reset */ | ||
110 | #define ELNRNG 41 /* Link number out of range */ | ||
111 | #define EUNATCH 42 /* Protocol driver not attached */ | ||
112 | #define ENOCSI 43 /* No CSI structure available */ | ||
113 | #define EL2HLT 44 /* Level 2 halted */ | ||
114 | #undef EDEADLK | ||
115 | #define EDEADLK 45 /* Deadlock condition */ | ||
116 | #undef ENOLCK | ||
117 | #define ENOLCK 46 /* No record locks available */ | ||
118 | #define EBADE 50 /* Invalid exchange */ | ||
119 | #define EBADR 51 /* Invalid request descriptor */ | ||
120 | #define EXFULL 52 /* Exchange full */ | ||
121 | #define ENOANO 53 /* No anode */ | ||
122 | #define EBADRQC 54 /* Invalid request code */ | ||
123 | #define EBADSLT 55 /* Invalid slot */ | ||
124 | #undef EDEADLOCK | ||
125 | #define EDEADLOCK 56 /* File locking deadlock error */ | ||
126 | #define EBFONT 57 /* Bad font file fmt */ | ||
127 | #define ENOSTR 60 /* Device not a stream */ | ||
128 | #define ENODATA 61 /* No data (for no delay io) */ | ||
129 | #define ETIME 62 /* Timer expired */ | ||
130 | #define ENOSR 63 /* Out of streams resources */ | ||
131 | #define ENONET 64 /* Machine is not on the network */ | ||
132 | #define ENOPKG 65 /* Package not installed */ | ||
133 | #define EREMOTE 66 /* The object is remote */ | ||
134 | #define ENOLINK 67 /* The link has been severed */ | ||
135 | #define EADV 68 /* Advertise error */ | ||
136 | #define ESRMNT 69 /* Srmount error */ | ||
137 | #define ECOMM 70 /* Communication error on send */ | ||
138 | #define EPROTO 71 /* Protocol error */ | ||
139 | #define EMULTIHOP 74 /* Multihop attempted */ | ||
140 | #define ELBIN 75 /* Inode is remote (not really error) */ | ||
141 | #define EDOTDOT 76 /* Cross mount point (not really error) */ | ||
142 | #define EBADMSG 77 /* Trying to read unreadable message */ | ||
143 | #define ENOTUNIQ 80 /* Given log. name not unique */ | ||
144 | #define EBADFD 81 /* f.d. invalid for this operation */ | ||
145 | #define EREMCHG 82 /* Remote address changed */ | ||
146 | #define ELIBACC 83 /* Can't access a needed shared lib */ | ||
147 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ | ||
148 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ | ||
149 | #define ELIBMAX 86 /* Attempting to link in too many libs */ | ||
150 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ | ||
151 | #undef ENOSYS | ||
152 | #define ENOSYS 88 /* Function not implemented */ | ||
153 | #define ENMFILE 89 /* No more files */ | ||
154 | #undef ENOTEMPTY | ||
155 | #define ENOTEMPTY 90 /* Directory not empty */ | ||
156 | #undef ENAMETOOLONG | ||
157 | #define ENAMETOOLONG 91 /* File or path name too long */ | ||
158 | #define ELOOP 92 /* Too many symbolic links */ | ||
159 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ | ||
160 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ | ||
161 | #define ECONNRESET 104 /* Connection reset by peer */ | ||
162 | #define ENOBUFS 105 /* No buffer space available */ | ||
163 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ | ||
164 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ | ||
165 | #define ENOTSOCK 108 /* Socket operation on non-socket */ | ||
166 | #define ENOPROTOOPT 109 /* Protocol not available */ | ||
167 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ | ||
168 | #define ECONNREFUSED 111 /* Connection refused */ | ||
169 | #define EADDRINUSE 112 /* Address already in use */ | ||
170 | #define ECONNABORTED 113 /* Connection aborted */ | ||
171 | #define ENETUNREACH 114 /* Network is unreachable */ | ||
172 | #define ENETDOWN 115 /* Network interface is not configured */ | ||
173 | #undef ETIMEDOUT | ||
174 | #define ETIMEDOUT 116 /* Connection timed out */ | ||
175 | #define EHOSTDOWN 117 /* Host is down */ | ||
176 | #define EHOSTUNREACH 118 /* Host is unreachable */ | ||
177 | #define EINPROGRESS 119 /* Connection already in progress */ | ||
178 | #define EALREADY 120 /* Socket already connected */ | ||
179 | #define EDESTADDRREQ 121 /* Destination address required */ | ||
180 | #define EMSGSIZE 122 /* Message too long */ | ||
181 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ | ||
182 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ | ||
183 | #define EADDRNOTAVAIL 125 /* Address not available */ | ||
184 | #define ENETRESET 126 /* Connection aborted by network */ | ||
185 | #define EISCONN 127 /* Socket is already connected */ | ||
186 | #define ENOTCONN 128 /* Socket is not connected */ | ||
187 | #define ETOOMANYREFS 129 /* Too many references: cannot splice */ | ||
188 | #define EPROCLIM 130 /* Too many processes */ | ||
189 | #define EUSERS 131 /* Too many users */ | ||
190 | #define EDQUOT 132 /* Disk quota exceeded */ | ||
191 | #define ESTALE 133 /* Unknown error */ | ||
192 | #undef ENOTSUP | ||
193 | #define ENOTSUP 134 /* Not supported */ | ||
194 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ | ||
195 | #define ENOSHARE 136 /* No such host or network path */ | ||
196 | #define ECASECLASH 137 /* Filename exists with different case */ | ||
197 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | ||
198 | |||
199 | #undef HOST_NOT_FOUND | ||
200 | #define HOST_NOT_FOUND 1 | ||
201 | #undef TRY_AGAIN | ||
202 | #define TRY_AGAIN 2 | ||
203 | #undef NO_RECOVERY | ||
204 | #define NO_RECOVERY 3 | ||
205 | #undef NO_ADDRESS | ||
206 | #define NO_ADDRESS 4 | ||
207 | |||
208 | #define PROT_READ 0x1 | ||
209 | #define PROT_WRITE 0x2 | ||
210 | #define MAP_SHARED 0x1 | ||
211 | #define MAP_PRIVATE 0x2 /* unsupported */ | ||
212 | #define MAP_FIXED 0x10 | ||
213 | |||
214 | struct statfs | ||
215 | { | ||
216 | long f_type; /* type of filesystem (see below) */ | ||
217 | long f_bsize; /* optimal transfer block size */ | ||
218 | long f_blocks; /* total data blocks in file system */ | ||
219 | long f_bfree; /* free blocks in fs */ | ||
220 | long f_bavail; /* free blocks avail to non-superuser */ | ||
221 | long f_files; /* total file nodes in file system */ | ||
222 | long f_ffree; /* free file nodes in fs */ | ||
223 | long f_fsid; /* file system id */ | ||
224 | long f_namelen; /* maximum length of filenames */ | ||
225 | long f_spare[6]; /* spare for later */ | ||
226 | }; | ||
227 | |||
228 | /* Taken from the Wine project <http://www.winehq.org> | ||
229 | /wine/include/winternl.h */ | ||
230 | enum SYSTEM_INFORMATION_CLASS | ||
231 | { | ||
232 | SystemBasicInformation = 0, | ||
233 | Unknown1, | ||
234 | SystemPerformanceInformation = 2, | ||
235 | SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ | ||
236 | Unknown4, | ||
237 | SystemProcessInformation = 5, | ||
238 | Unknown6, | ||
239 | Unknown7, | ||
240 | SystemProcessorPerformanceInformation = 8, | ||
241 | Unknown9, | ||
242 | Unknown10, | ||
243 | SystemDriverInformation, | ||
244 | Unknown12, | ||
245 | Unknown13, | ||
246 | Unknown14, | ||
247 | Unknown15, | ||
248 | SystemHandleList, | ||
249 | Unknown17, | ||
250 | Unknown18, | ||
251 | Unknown19, | ||
252 | Unknown20, | ||
253 | SystemCacheInformation, | ||
254 | Unknown22, | ||
255 | SystemInterruptInformation = 23, | ||
256 | SystemExceptionInformation = 33, | ||
257 | SystemRegistryQuotaInformation = 37, | ||
258 | SystemLookasideInformation = 45 | ||
259 | }; | ||
260 | |||
261 | typedef struct | ||
262 | { | ||
263 | LARGE_INTEGER IdleTime; | ||
264 | LARGE_INTEGER KernelTime; | ||
265 | LARGE_INTEGER UserTime; | ||
266 | LARGE_INTEGER Reserved1[2]; | ||
267 | ULONG Reserved2; | ||
268 | } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; | ||
269 | |||
270 | #define sleep(secs) (Sleep(secs * 1000)) | ||
271 | |||
272 | /*********************** statfs *****************************/ | ||
273 | /* fake block size */ | ||
274 | #define FAKED_BLOCK_SIZE 512 | ||
275 | |||
276 | /* linux-compatible values for fs type */ | ||
277 | #define MSDOS_SUPER_MAGIC 0x4d44 | ||
278 | #define NTFS_SUPER_MAGIC 0x5346544E | ||
279 | |||
280 | /*********************** End of statfs ***********************/ | ||
281 | |||
282 | #define SHUT_RDWR SD_BOTH | ||
283 | |||
284 | /* Operations for flock() */ | ||
285 | #define LOCK_SH 1 /* shared lock */ | ||
286 | #define LOCK_EX 2 /* exclusive lock */ | ||
287 | #define LOCK_NB 4 /* or'd with one of the above to prevent | ||
288 | blocking */ | ||
289 | #define LOCK_UN 8 /* remove lock */ | ||
290 | |||
291 | /* Not supported under MinGW */ | ||
292 | #define S_IRGRP 0 | ||
293 | #define S_IWGRP 0 | ||
294 | #define S_IROTH 0 | ||
295 | #define S_IXGRP 0 | ||
296 | #define S_IWOTH 0 | ||
297 | #define S_IXOTH 0 | ||
298 | #define S_ISUID 0 | ||
299 | #define S_ISGID 0 | ||
300 | #define S_ISVTX 0 | ||
301 | #define S_IRWXG 0 | ||
302 | #define S_IRWXO 0 | ||
303 | |||
304 | #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__) | ||
305 | |||
306 | /** | ||
307 | * @brief index() - same as strchr() | ||
308 | */ | ||
309 | #define index(s, c) strchr(s, c) | ||
310 | |||
311 | BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); | ||
312 | BOOL _plibc_DereferenceShortcut(char *pszShortcut); | ||
313 | long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey, | ||
314 | char *pszBuffer, long *pdLength); | ||
315 | |||
316 | BOOL __win_IsHandleMarkedAsBlocking(SOCKET hHandle); | ||
317 | void __win_SetHandleBlockingMode(SOCKET s, BOOL bBlocking); | ||
318 | void __win_DiscardHandleBlockingMode(SOCKET s); | ||
319 | int _win_isSocketValid(int s); | ||
320 | int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); | ||
321 | |||
322 | typedef void (*TPanicProc) (int, char *); | ||
323 | void plibc_set_panic_proc(TPanicProc proc); | ||
324 | |||
325 | int flock(int fd, int operation); | ||
326 | int fsync(int fildes); | ||
327 | int inet_pton(int af, const char *src, void *dst); | ||
328 | int inet_pton4(const char *src, u_char *dst, int pton); | ||
329 | #if USE_IPV6 | ||
330 | int inet_pton6(const char *src, u_char *dst); | ||
331 | #endif | ||
332 | int truncate(const char *fname, int distance); | ||
333 | int statfs(const char *path, struct statfs *buf); | ||
334 | const char *hstrerror(int err); | ||
335 | void gettimeofday(struct timeval *tp, void *tzp); | ||
336 | int mkstemp(char *tmplate); | ||
337 | char *strptime (const char *buf, const char *format, struct tm *tm); | ||
338 | char *ctime(const time_t *clock); | ||
339 | char *ctime_r(const time_t *clock, char *buf); | ||
340 | int plibc_init(char *pszOrg, char *pszApp); | ||
341 | void plibc_shutdown(void); | ||
342 | int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int derefLinks); | ||
343 | void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); | ||
344 | void SetErrnoFromWinsockError(long lWinError); | ||
345 | void SetHErrnoFromWinError(long lWinError); | ||
346 | void SetErrnoFromHRESULT(HRESULT hRes); | ||
347 | FILE *_win_fopen(const char *filename, const char *mode); | ||
348 | DIR *_win_opendir(const char *dirname); | ||
349 | int _win_open(const char *filename, int oflag, ...); | ||
350 | #ifdef ENABLE_NLS | ||
351 | char *_win_bindtextdomain(const char *domainname, const char *dirname); | ||
352 | #endif | ||
353 | int _win_chdir(const char *path); | ||
354 | int _win_close(int fd); | ||
355 | int _win_creat(const char *path, mode_t mode); | ||
356 | int _win_fstat(int handle, struct stat *buffer); | ||
357 | int _win_pipe(int *phandles); | ||
358 | int _win_rmdir(const char *path); | ||
359 | int _win_access( const char *path, int mode ); | ||
360 | int _win_chmod(const char *filename, int pmode); | ||
361 | char *realpath(const char *file_name, char *resolved_name); | ||
362 | int _win_remove(const char *path); | ||
363 | int _win_rename(const char *oldname, const char *newname); | ||
364 | int _win_stat(const char *path, struct stat *buffer); | ||
365 | int _win_unlink(const char *filename); | ||
366 | int _win_write(int fildes, const void *buf, size_t nbyte); | ||
367 | int _win_read(int fildes, void *buf, size_t nbyte); | ||
368 | size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE *stream); | ||
369 | size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream ); | ||
370 | int _win_symlink(const char *path1, const char *path2); | ||
371 | void *_win_mmap(void *start, size_t len, int access, int flags, int fd, | ||
372 | unsigned long long offset); | ||
373 | int _win_munmap(void *start, size_t length); | ||
374 | int _win_lstat(const char *path, struct stat *buf); | ||
375 | int _win_readlink(const char *path, char *buf, size_t bufsize); | ||
376 | int _win_accept(SOCKET s, struct sockaddr *addr, int *addrlen); | ||
377 | int _win_printf(const char *format,...); | ||
378 | int _win_fprintf(FILE *f,const char *format,...); | ||
379 | int _win_vprintf(const char *format, va_list ap); | ||
380 | int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); | ||
381 | int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); | ||
382 | int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); | ||
383 | int _win_snprintf(char *str,size_t size,const char *format,...); | ||
384 | int _win_sprintf(char *dest,const char *format,...); | ||
385 | int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); | ||
386 | int _win_sscanf(const char *str, const char *format, ...); | ||
387 | int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); | ||
388 | int _win_vscanf(const char *format, va_list arg_ptr); | ||
389 | int _win_scanf(const char *format, ...); | ||
390 | int _win_fscanf(FILE *stream, const char *format, ...); | ||
391 | int _win_bind(SOCKET s, const struct sockaddr *name, int namelen); | ||
392 | int _win_connect(SOCKET s,const struct sockaddr *name, int namelen); | ||
393 | int _win_getpeername(SOCKET s, struct sockaddr *name, | ||
394 | int *namelen); | ||
395 | int _win_getsockname(SOCKET s, struct sockaddr *name, | ||
396 | int *namelen); | ||
397 | int _win_getsockopt(SOCKET s, int level, int optname, char *optval, | ||
398 | int *optlen); | ||
399 | int _win_listen(SOCKET s, int backlog); | ||
400 | int _win_recv(SOCKET s, char *buf, int len, int flags); | ||
401 | int _win_recvfrom(SOCKET s, void *buf, int len, int flags, | ||
402 | struct sockaddr *from, int *fromlen); | ||
403 | int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, | ||
404 | const struct timeval *tv); | ||
405 | int _win_send(SOCKET s, const char *buf, int len, int flags); | ||
406 | int _win_sendto(SOCKET s, const char *buf, int len, int flags, | ||
407 | const struct sockaddr *to, int tolen); | ||
408 | int _win_setsockopt(SOCKET s, int level, int optname, const void *optval, | ||
409 | int optlen); | ||
410 | int _win_shutdown(SOCKET s, int how); | ||
411 | SOCKET _win_socket(int af, int type, int protocol); | ||
412 | struct hostent *_win_gethostbyaddr(const char *addr, int len, int type); | ||
413 | struct hostent *_win_gethostbyname(const char *name); | ||
414 | char *_win_strerror(int errnum); | ||
415 | int IsWinNT(void); | ||
416 | |||
417 | #if !HAVE_STRNDUP | ||
418 | char *strndup (const char *s, size_t n); | ||
419 | #endif | ||
420 | #if !HAVE_STRNLEN | ||
421 | size_t strnlen (const char *str, size_t maxlen); | ||
422 | #endif | ||
423 | |||
424 | #endif /* WINDOWS */ | ||
425 | |||
426 | #ifndef WINDOWS | ||
427 | #define DIR_SEPARATOR '/' | ||
428 | #define DIR_SEPARATOR_STR "/" | ||
429 | #define NEWLINE "\n" | ||
430 | |||
431 | #ifdef ENABLE_NLS | ||
432 | #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) | ||
433 | #endif | ||
434 | #define CREAT(p, m) creat(p, m) | ||
435 | #undef FOPEN | ||
436 | #define FOPEN(f, m) fopen(f, m) | ||
437 | #define OPENDIR(d) opendir(d) | ||
438 | #define OPEN(f) open(f) | ||
439 | #define CHDIR(d) chdir(d) | ||
440 | #define CLOSE(f) close(f) | ||
441 | #define RMDIR(f) rmdir(f) | ||
442 | #define ACCESS(p, m) access(p, m) | ||
443 | #define CHMOD(f, p) chmod(f, p) | ||
444 | #define FSTAT(h, b) fstat(h, b) | ||
445 | #define PIPE(h) pipe(h) | ||
446 | #define REMOVE(p) remove(p) | ||
447 | #define RENAME(o, n) rename(o, n) | ||
448 | #define STAT(p, b) stat(p, b) | ||
449 | #define UNLINK(f) unlink(f) | ||
450 | #define WRITE(f, b, n) write(f, b, n) | ||
451 | #define READ(f, b, n) read(f, b, n) | ||
452 | #define GN_FREAD(b, s, c, f) fread(b, s, c, f) | ||
453 | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) | ||
454 | #define SYMLINK(a, b) symlink(a, b) | ||
455 | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) | ||
456 | #define MUNMAP(s, l) munmap(s, l) | ||
457 | #define STRERROR(i) strerror(i) | ||
458 | #define READLINK(p, b, s) readlink(p, b, s) | ||
459 | #define LSTAT(p, b) lstat(p, b) | ||
460 | #define PRINTF(f, ...) printf(f , __VA_ARGS__) | ||
461 | #define FPRINTF(fil, fmt, ...) fprintf(fil, fmt, __VA_ARGS__) | ||
462 | #define VPRINTF(f, a) vprintf(f, a) | ||
463 | #define VFPRINTF(s, f, a) vfprintf(s, f, a) | ||
464 | #define VSPRINTF(d, f, a) vsprintf(d, f, a) | ||
465 | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) | ||
466 | #define _REAL_SNPRINTF(str, size, fmt, ...) snprintf(str, size, fmt, __VA_ARGS__) | ||
467 | #define SPRINTF(d, f, ...) sprintf(d, f, __VA_ARGS__) | ||
468 | #define VSSCANF(s, f, a) vsscanf(s, f, a) | ||
469 | #define SSCANF(s, f, ...) sscanf(s, f, __VA_ARGS__) | ||
470 | #define VFSCANF(s, f, a) vfscanf(s, f, a) | ||
471 | #define VSCANF(f, a) vscanf(f, a) | ||
472 | #define SCANF(f, ...) scanf(f, __VA_ARGS__) | ||
473 | #define FSCANF(s, f, ...) fscanf(s, f, __VA_ARGS__) | ||
474 | #define ACCEPT(s, a, l) accept(s, a, l) | ||
475 | #define BIND(s, n, l) bind(s, n, l) | ||
476 | #define CONNECT(s, n, l) connect(s, n, l) | ||
477 | #define GETPEERNAME(s, n, l) getpeername(s, n, l) | ||
478 | #define GETSOCKNAME(s, n, l) getsockname(s, n, l) | ||
479 | #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) | ||
480 | #define LISTEN(s, b) listen(s, b) | ||
481 | #define RECV(s, b, l, f) recv(s, b, l, f) | ||
482 | #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) | ||
483 | #define SELECT(n, r, w, e, t) select(n, r, w, e, t) | ||
484 | #define SEND(s, b, l, f) send(s, b, l, f) | ||
485 | #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) | ||
486 | #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) | ||
487 | #define SHUTDOWN(s, h) shutdown(s, h) | ||
488 | #define SOCKET(a, t, p) socket(a, t, p) | ||
489 | #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) | ||
490 | #define GETHOSTBYNAME(n) gethostbyname(n) | ||
491 | #else | ||
492 | #define DIR_SEPARATOR '\\' | ||
493 | #define DIR_SEPARATOR_STR "\\" | ||
494 | #define NEWLINE "\r\n" | ||
495 | |||
496 | #ifdef ENABLE_NLS | ||
497 | #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) | ||
498 | #endif | ||
499 | #define CREAT(p, m) _win_creat(p, m) | ||
500 | #define FOPEN(f, m) _win_fopen(f, m) | ||
501 | #define OPENDIR(d) _win_opendir(d) | ||
502 | #define OPEN(f) _win_open(f) | ||
503 | #define CHDIR(d) _win_chdir(d) | ||
504 | #define CLOSE(f) _win_close(f) | ||
505 | #define FSTAT(h, b) _win_fstat(h, b) | ||
506 | #define RMDIR(f) _win_rmdir(f) | ||
507 | #define ACCESS(p, m) _win_access(p, m) | ||
508 | #define CHMOD(f, p) _win_chmod(f, p) | ||
509 | #define PIPE(h) _win_pipe(h) | ||
510 | #define REMOVE(p) _win_remove(p) | ||
511 | #define RENAME(o, n) _win_rename(o, n) | ||
512 | #define STAT(p, b) _win_stat(p, b) | ||
513 | #define UNLINK(f) _win_unlink(f) | ||
514 | #define WRITE(f, b, n) _win_write(f, b, n) | ||
515 | #define READ(f, b, n) _win_read(f, b, n) | ||
516 | #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) | ||
517 | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) | ||
518 | #define SYMLINK(a, b) _win_symlink(a, b) | ||
519 | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) | ||
520 | #define MUNMAP(s, l) _win_munmap(s, l) | ||
521 | #define STRERROR(i) _win_strerror(i) | ||
522 | #define READLINK(p, b, s) _win_readlink(p, b, s) | ||
523 | #define LSTAT(p, b) _win_lstat(p, b) | ||
524 | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) | ||
525 | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) | ||
526 | #define VPRINTF(f, a) _win_vprintf(f, a) | ||
527 | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) | ||
528 | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) | ||
529 | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) | ||
530 | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) | ||
531 | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) | ||
532 | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) | ||
533 | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) | ||
534 | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) | ||
535 | #define VSCANF(f, a) _win_vscanf(f, a) | ||
536 | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) | ||
537 | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) | ||
538 | #define ACCEPT(s, a, l) _win_accept(s, a, l) | ||
539 | #define BIND(s, n, l) _win_bind(s, n, l) | ||
540 | #define CONNECT(s, n, l) _win_connect(s, n, l) | ||
541 | #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) | ||
542 | #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) | ||
543 | #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) | ||
544 | #define LISTEN(s, b) _win_listen(s, b) | ||
545 | #define RECV(s, b, l, f) _win_recv(s, b, l, f) | ||
546 | #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) | ||
547 | #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) | ||
548 | #define SEND(s, b, l, f) _win_send(s, b, l, f) | ||
549 | #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) | ||
550 | #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) | ||
551 | #define SHUTDOWN(s, h) _win_shutdown(s, h) | ||
552 | #define SOCKET(a, t, p) _win_socket(a, t, p) | ||
553 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) | ||
554 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) | ||
555 | #endif | ||
556 | |||
557 | |||
558 | #ifdef __cplusplus | ||
559 | } | ||
560 | #endif | ||
561 | |||
562 | |||
563 | #endif //_PLIBC_H_ | ||
564 | |||
565 | /* end of plibc.h */ | ||