aboutsummaryrefslogtreecommitdiff
path: root/src/include/plibc.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2007-07-10 09:01:06 +0000
committerChristian Grothoff <christian@grothoff.org>2007-07-10 09:01:06 +0000
commitce124c66c8aff19abaa695a16127a742050d01b4 (patch)
treeec813c1b394f5566655fa6ff52cfba45a14847d7 /src/include/plibc.h
parentb2f6fe964b05c6995bcb50ebe29cf25f1c185f84 (diff)
downloadgnunet-gtk-ce124c66c8aff19abaa695a16127a742050d01b4.tar.gz
gnunet-gtk-ce124c66c8aff19abaa695a16127a742050d01b4.zip
indent
Diffstat (limited to 'src/include/plibc.h')
-rw-r--r--src/include/plibc.h744
1 files changed, 373 insertions, 371 deletions
diff --git a/src/include/plibc.h b/src/include/plibc.h
index 7118c69d..2178dc76 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
36extern "C" { 36extern "C"
37{
37#endif 38#endif
38 39
39#ifdef WINDOWS 40#ifdef WINDOWS
40 41
41#if ENABLE_NLS 42#if ENABLE_NLS
42 #include "langinfo.h" 43#include "langinfo.h"
43#endif 44#endif
44 45
45#include <windows.h> 46#include <windows.h>
@@ -71,109 +72,109 @@ extern "C" {
71#define int32_t long 72#define int32_t long
72 73
73#ifndef pid_t 74#ifndef pid_t
74 #define pid_t int 75#define pid_t int
75#endif 76#endif
76 77
77#ifndef WEXITSTATUS 78#ifndef WEXITSTATUS
78 #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) 79#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
79#endif 80#endif
80 81
81/* Thanks to the Cygwin project */ 82/* Thanks to the Cygwin project */
82#define ENOCSI 43 /* No CSI structure available */ 83#define ENOCSI 43 /* No CSI structure available */
83#define EL2HLT 44 /* Level 2 halted */ 84#define EL2HLT 44 /* Level 2 halted */
84#ifndef EDEADLK 85#ifndef EDEADLK
85 #define EDEADLK 45 /* Deadlock condition */ 86#define EDEADLK 45 /* Deadlock condition */
86#endif 87#endif
87#ifndef ENOLCK 88#ifndef ENOLCK
88 #define ENOLCK 46 /* No record locks available */ 89#define ENOLCK 46 /* No record locks available */
89#endif 90#endif
90#define EBADE 50 /* Invalid exchange */ 91#define EBADE 50 /* Invalid exchange */
91#define EBADR 51 /* Invalid request descriptor */ 92#define EBADR 51 /* Invalid request descriptor */
92#define EXFULL 52 /* Exchange full */ 93#define EXFULL 52 /* Exchange full */
93#define ENOANO 53 /* No anode */ 94#define ENOANO 53 /* No anode */
94#define EBADRQC 54 /* Invalid request code */ 95#define EBADRQC 54 /* Invalid request code */
95#define EBADSLT 55 /* Invalid slot */ 96#define EBADSLT 55 /* Invalid slot */
96#ifndef EDEADLOCK 97#ifndef EDEADLOCK
97 #define EDEADLOCK EDEADLK /* File locking deadlock error */ 98#define EDEADLOCK EDEADLK /* File locking deadlock error */
98#endif 99#endif
99#define EBFONT 57 /* Bad font file fmt */ 100#define EBFONT 57 /* Bad font file fmt */
100#define ENOSTR 60 /* Device not a stream */ 101#define ENOSTR 60 /* Device not a stream */
101#define ENODATA 61 /* No data (for no delay io) */ 102#define ENODATA 61 /* No data (for no delay io) */
102#define ETIME 62 /* Timer expired */ 103#define ETIME 62 /* Timer expired */
103#define ENOSR 63 /* Out of streams resources */ 104#define ENOSR 63 /* Out of streams resources */
104#define ENONET 64 /* Machine is not on the network */ 105#define ENONET 64 /* Machine is not on the network */
105#define ENOPKG 65 /* Package not installed */ 106#define ENOPKG 65 /* Package not installed */
106#define EREMOTE 66 /* The object is remote */ 107#define EREMOTE 66 /* The object is remote */
107#define ENOLINK 67 /* The link has been severed */ 108#define ENOLINK 67 /* The link has been severed */
108#define EADV 68 /* Advertise error */ 109#define EADV 68 /* Advertise error */
109#define ESRMNT 69 /* Srmount error */ 110#define ESRMNT 69 /* Srmount error */
110#define ECOMM 70 /* Communication error on send */ 111#define ECOMM 70 /* Communication error on send */
111#define EPROTO 71 /* Protocol error */ 112#define EPROTO 71 /* Protocol error */
112#define EMULTIHOP 74 /* Multihop attempted */ 113#define EMULTIHOP 74 /* Multihop attempted */
113#define ELBIN 75 /* Inode is remote (not really error) */ 114#define ELBIN 75 /* Inode is remote (not really error) */
114#define EDOTDOT 76 /* Cross mount point (not really error) */ 115#define EDOTDOT 76 /* Cross mount point (not really error) */
115#define EBADMSG 77 /* Trying to read unreadable message */ 116#define EBADMSG 77 /* Trying to read unreadable message */
116#define ENOTUNIQ 80 /* Given log. name not unique */ 117#define ENOTUNIQ 80 /* Given log. name not unique */
117#define EBADFD 81 /* f.d. invalid for this operation */ 118#define EBADFD 81 /* f.d. invalid for this operation */
118#define EREMCHG 82 /* Remote address changed */ 119#define EREMCHG 82 /* Remote address changed */
119#define ELIBACC 83 /* Can't access a needed shared lib */ 120#define ELIBACC 83 /* Can't access a needed shared lib */
120#define ELIBBAD 84 /* Accessing a corrupted shared lib */ 121#define ELIBBAD 84 /* Accessing a corrupted shared lib */
121#define ELIBSCN 85 /* .lib section in a.out corrupted */ 122#define ELIBSCN 85 /* .lib section in a.out corrupted */
122#define ELIBMAX 86 /* Attempting to link in too many libs */ 123#define ELIBMAX 86 /* Attempting to link in too many libs */
123#define ELIBEXEC 87 /* Attempting to exec a shared library */ 124#define ELIBEXEC 87 /* Attempting to exec a shared library */
124#ifndef ENOSYS 125#ifndef ENOSYS
125 #define ENOSYS 88 /* Function not implemented */ 126#define ENOSYS 88 /* Function not implemented */
126#endif 127#endif
127#define ENMFILE 89 /* No more files */ 128#define ENMFILE 89 /* No more files */
128#ifndef ENOTEMPTY 129#ifndef ENOTEMPTY
129 #define ENOTEMPTY 90 /* Directory not empty */ 130#define ENOTEMPTY 90 /* Directory not empty */
130#endif 131#endif
131#ifndef ENAMETOOLONG 132#ifndef ENAMETOOLONG
132 #define ENAMETOOLONG 91 /* File or path name too long */ 133#define ENAMETOOLONG 91 /* File or path name too long */
133#endif 134#endif
134#define ELOOP 92 /* Too many symbolic links */ 135#define ELOOP 92 /* Too many symbolic links */
135#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ 136#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
136#define EPFNOSUPPORT 96 /* Protocol family not supported */ 137#define EPFNOSUPPORT 96 /* Protocol family not supported */
137#define ECONNRESET 104 /* Connection reset by peer */ 138#define ECONNRESET 104 /* Connection reset by peer */
138#define ENOBUFS 105 /* No buffer space available */ 139#define ENOBUFS 105 /* No buffer space available */
139#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ 140#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
140#define EPROTOTYPE 107 /* Protocol wrong type for socket */ 141#define EPROTOTYPE 107 /* Protocol wrong type for socket */
141#define ENOTSOCK 108 /* Socket operation on non-socket */ 142#define ENOTSOCK 108 /* Socket operation on non-socket */
142#define ENOPROTOOPT 109 /* Protocol not available */ 143#define ENOPROTOOPT 109 /* Protocol not available */
143#define ESHUTDOWN 110 /* Can't send after socket shutdown */ 144#define ESHUTDOWN 110 /* Can't send after socket shutdown */
144#define ECONNREFUSED 111 /* Connection refused */ 145#define ECONNREFUSED 111 /* Connection refused */
145#define EADDRINUSE 112 /* Address already in use */ 146#define EADDRINUSE 112 /* Address already in use */
146#define ECONNABORTED 113 /* Connection aborted */ 147#define ECONNABORTED 113 /* Connection aborted */
147#define ENETUNREACH 114 /* Network is unreachable */ 148#define ENETUNREACH 114 /* Network is unreachable */
148#define ENETDOWN 115 /* Network interface is not configured */ 149#define ENETDOWN 115 /* Network interface is not configured */
149#ifndef ETIMEDOUT 150#ifndef ETIMEDOUT
150 #define ETIMEDOUT 116 /* Connection timed out */ 151#define ETIMEDOUT 116 /* Connection timed out */
151#endif 152#endif
152#define EHOSTDOWN 117 /* Host is down */ 153#define EHOSTDOWN 117 /* Host is down */
153#define EHOSTUNREACH 118 /* Host is unreachable */ 154#define EHOSTUNREACH 118 /* Host is unreachable */
154#define EINPROGRESS 119 /* Connection already in progress */ 155#define EINPROGRESS 119 /* Connection already in progress */
155#define EALREADY 120 /* Socket already connected */ 156#define EALREADY 120 /* Socket already connected */
156#define EDESTADDRREQ 121 /* Destination address required */ 157#define EDESTADDRREQ 121 /* Destination address required */
157#define EMSGSIZE 122 /* Message too long */ 158#define EMSGSIZE 122 /* Message too long */
158#define EPROTONOSUPPORT 123 /* Unknown protocol */ 159#define EPROTONOSUPPORT 123 /* Unknown protocol */
159#define ESOCKTNOSUPPORT 124 /* Socket type not supported */ 160#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
160#define EADDRNOTAVAIL 125 /* Address not available */ 161#define EADDRNOTAVAIL 125 /* Address not available */
161#define ENETRESET 126 /* Connection aborted by network */ 162#define ENETRESET 126 /* Connection aborted by network */
162#define EISCONN 127 /* Socket is already connected */ 163#define EISCONN 127 /* Socket is already connected */
163#define ENOTCONN 128 /* Socket is not connected */ 164#define ENOTCONN 128 /* Socket is not connected */
164#define ETOOMANYREFS 129 /* Too many references: cannot splice */ 165#define ETOOMANYREFS 129 /* Too many references: cannot splice */
165#define EPROCLIM 130 /* Too many processes */ 166#define EPROCLIM 130 /* Too many processes */
166#define EUSERS 131 /* Too many users */ 167#define EUSERS 131 /* Too many users */
167#define EDQUOT 132 /* Disk quota exceeded */ 168#define EDQUOT 132 /* Disk quota exceeded */
168#define ESTALE 133 /* Unknown error */ 169#define ESTALE 133 /* Unknown error */
169#ifndef ENOTSUP 170#ifndef ENOTSUP
170 #define ENOTSUP 134 /* Not supported */ 171#define ENOTSUP 134 /* Not supported */
171#endif 172#endif
172#define ENOMEDIUM 135 /* No medium (in tape drive) */ 173#define ENOMEDIUM 135 /* No medium (in tape drive) */
173#define ENOSHARE 136 /* No such host or network path */ 174#define ENOSHARE 136 /* No such host or network path */
174#define ECASECLASH 137 /* Filename exists with different case */ 175#define ECASECLASH 137 /* Filename exists with different case */
175#define EWOULDBLOCK EAGAIN /* Operation would block */ 176#define EWOULDBLOCK EAGAIN /* Operation would block */
176#define EOVERFLOW 139 /* Value too large for defined data type */ 177#define EOVERFLOW 139 /* Value too large for defined data type */
177 178
178#undef HOST_NOT_FOUND 179#undef HOST_NOT_FOUND
179#define HOST_NOT_FOUND 1 180#define HOST_NOT_FOUND 1
@@ -187,65 +188,65 @@ extern "C" {
187#define PROT_READ 0x1 188#define PROT_READ 0x1
188#define PROT_WRITE 0x2 189#define PROT_WRITE 0x2
189#define MAP_SHARED 0x1 190#define MAP_SHARED 0x1
190#define MAP_PRIVATE 0x2 /* unsupported */ 191#define MAP_PRIVATE 0x2 /* unsupported */
191#define MAP_FIXED 0x10 192#define MAP_FIXED 0x10
192#define MAP_FAILED ((void *)-1) 193#define MAP_FAILED ((void *)-1)
193 194
194struct statfs 195 struct statfs
195{ 196 {
196 long f_type; /* type of filesystem (see below) */ 197 long f_type; /* type of filesystem (see below) */
197 long f_bsize; /* optimal transfer block size */ 198 long f_bsize; /* optimal transfer block size */
198 long f_blocks; /* total data blocks in file system */ 199 long f_blocks; /* total data blocks in file system */
199 long f_bfree; /* free blocks in fs */ 200 long f_bfree; /* free blocks in fs */
200 long f_bavail; /* free blocks avail to non-superuser */ 201 long f_bavail; /* free blocks avail to non-superuser */
201 long f_files; /* total file nodes in file system */ 202 long f_files; /* total file nodes in file system */
202 long f_ffree; /* free file nodes in fs */ 203 long f_ffree; /* free file nodes in fs */
203 long f_fsid; /* file system id */ 204 long f_fsid; /* file system id */
204 long f_namelen; /* maximum length of filenames */ 205 long f_namelen; /* maximum length of filenames */
205 long f_spare[6]; /* spare for later */ 206 long f_spare[6]; /* spare for later */
206}; 207 };
207 208
208/* Taken from the Wine project <http://www.winehq.org> 209/* Taken from the Wine project <http://www.winehq.org>
209 /wine/include/winternl.h */ 210 /wine/include/winternl.h */
210enum SYSTEM_INFORMATION_CLASS 211 enum SYSTEM_INFORMATION_CLASS
211{ 212 {
212 SystemBasicInformation = 0, 213 SystemBasicInformation = 0,
213 Unknown1, 214 Unknown1,
214 SystemPerformanceInformation = 2, 215 SystemPerformanceInformation = 2,
215 SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ 216 SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */
216 Unknown4, 217 Unknown4,
217 SystemProcessInformation = 5, 218 SystemProcessInformation = 5,
218 Unknown6, 219 Unknown6,
219 Unknown7, 220 Unknown7,
220 SystemProcessorPerformanceInformation = 8, 221 SystemProcessorPerformanceInformation = 8,
221 Unknown9, 222 Unknown9,
222 Unknown10, 223 Unknown10,
223 SystemDriverInformation, 224 SystemDriverInformation,
224 Unknown12, 225 Unknown12,
225 Unknown13, 226 Unknown13,
226 Unknown14, 227 Unknown14,
227 Unknown15, 228 Unknown15,
228 SystemHandleList, 229 SystemHandleList,
229 Unknown17, 230 Unknown17,
230 Unknown18, 231 Unknown18,
231 Unknown19, 232 Unknown19,
232 Unknown20, 233 Unknown20,
233 SystemCacheInformation, 234 SystemCacheInformation,
234 Unknown22, 235 Unknown22,
235 SystemInterruptInformation = 23, 236 SystemInterruptInformation = 23,
236 SystemExceptionInformation = 33, 237 SystemExceptionInformation = 33,
237 SystemRegistryQuotaInformation = 37, 238 SystemRegistryQuotaInformation = 37,
238 SystemLookasideInformation = 45 239 SystemLookasideInformation = 45
239}; 240 };
240 241
241typedef struct 242 typedef struct
242{ 243 {
243 LARGE_INTEGER IdleTime; 244 LARGE_INTEGER IdleTime;
244 LARGE_INTEGER KernelTime; 245 LARGE_INTEGER KernelTime;
245 LARGE_INTEGER UserTime; 246 LARGE_INTEGER UserTime;
246 LARGE_INTEGER Reserved1[2]; 247 LARGE_INTEGER Reserved1[2];
247 ULONG Reserved2; 248 ULONG Reserved2;
248} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; 249 } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
249 250
250#define sleep(secs) (Sleep(secs * 1000)) 251#define sleep(secs) (Sleep(secs * 1000))
251 252
@@ -262,11 +263,11 @@ typedef struct
262#define SHUT_RDWR SD_BOTH 263#define SHUT_RDWR SD_BOTH
263 264
264/* Operations for flock() */ 265/* Operations for flock() */
265#define LOCK_SH 1 /* shared lock */ 266#define LOCK_SH 1 /* shared lock */
266#define LOCK_EX 2 /* exclusive lock */ 267#define LOCK_EX 2 /* exclusive lock */
267#define LOCK_NB 4 /* or'd with one of the above to prevent 268#define LOCK_NB 4 /* or'd with one of the above to prevent
268 blocking */ 269 blocking */
269#define LOCK_UN 8 /* remove lock */ 270#define LOCK_UN 8 /* remove lock */
270 271
271/* Not supported under MinGW */ 272/* Not supported under MinGW */
272#define S_IRGRP 0 273#define S_IRGRP 0
@@ -288,258 +289,259 @@ typedef struct
288 */ 289 */
289#define index(s, c) strchr(s, c) 290#define index(s, c) strchr(s, c)
290 291
291BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); 292 BOOL _plibc_CreateShortcut (const char *pszSrc, const char *pszDest);
292BOOL _plibc_DereferenceShortcut(char *pszShortcut); 293 BOOL _plibc_DereferenceShortcut (char *pszShortcut);
293char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); 294 char *plibc_ChooseDir (char *pszTitle, unsigned long ulFlags);
294char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); 295 char *plibc_ChooseFile (char *pszTitle, unsigned long ulFlags);
295long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey, 296 long QueryRegistry (HKEY hMainKey, char *pszKey, char *pszSubKey,
296 char *pszBuffer, long *pdLength); 297 char *pszBuffer, long *pdLength);
297 298
298BOOL __win_IsHandleMarkedAsBlocking(SOCKET hHandle); 299 BOOL __win_IsHandleMarkedAsBlocking (SOCKET hHandle);
299void __win_SetHandleBlockingMode(SOCKET s, BOOL bBlocking); 300 void __win_SetHandleBlockingMode (SOCKET s, BOOL bBlocking);
300void __win_DiscardHandleBlockingMode(SOCKET s); 301 void __win_DiscardHandleBlockingMode (SOCKET s);
301int _win_isSocketValid(int s); 302 int _win_isSocketValid (int s);
302int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); 303 int plibc_conv_to_win_path (const char *pszUnix, char *pszWindows);
303 304
304typedef void (*TPanicProc) (int, char *); 305 typedef void (*TPanicProc) (int, char *);
305void plibc_set_panic_proc(TPanicProc proc); 306 void plibc_set_panic_proc (TPanicProc proc);
306 307
307int flock(int fd, int operation); 308 int flock (int fd, int operation);
308int fsync(int fildes); 309 int fsync (int fildes);
309int inet_pton(int af, const char *src, void *dst); 310 int inet_pton (int af, const char *src, void *dst);
310int inet_pton4(const char *src, u_char *dst, int pton); 311 int inet_pton4 (const char *src, u_char * dst, int pton);
311#if USE_IPV6 312#if USE_IPV6
312int inet_pton6(const char *src, u_char *dst); 313 int inet_pton6 (const char *src, u_char * dst);
313#endif 314#endif
314int truncate(const char *fname, int distance); 315 int truncate (const char *fname, int distance);
315int statfs(const char *path, struct statfs *buf); 316 int statfs (const char *path, struct statfs *buf);
316const char *hstrerror(int err); 317 const char *hstrerror (int err);
317void gettimeofday(struct timeval *tp, void *tzp); 318 void gettimeofday (struct timeval *tp, void *tzp);
318int mkstemp(char *tmplate); 319 int mkstemp (char *tmplate);
319char *strptime (const char *buf, const char *format, struct tm *tm); 320 char *strptime (const char *buf, const char *format, struct tm *tm);
320char *ctime(const time_t *clock); 321 char *ctime (const time_t * clock);
321char *ctime_r(const time_t *clock, char *buf); 322 char *ctime_r (const time_t * clock, char *buf);
322int plibc_init(char *pszOrg, char *pszApp); 323 int plibc_init (char *pszOrg, char *pszApp);
323void plibc_shutdown(); 324 void plibc_shutdown ();
324int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int derefLinks); 325 int plibc_conv_to_win_path_ex (const char *pszUnix, char *pszWindows,
325void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); 326 int derefLinks);
326void SetErrnoFromWinsockError(long lWinError); 327 void _SetErrnoFromWinError (long lWinError, char *pszCaller, int iLine);
327void SetHErrnoFromWinError(long lWinError); 328 void SetErrnoFromWinsockError (long lWinError);
328void SetErrnoFromHRESULT(HRESULT hRes); 329 void SetHErrnoFromWinError (long lWinError);
329FILE *_win_fopen(const char *filename, const char *mode); 330 void SetErrnoFromHRESULT (HRESULT hRes);
330DIR *_win_opendir(const char *dirname); 331 FILE *_win_fopen (const char *filename, const char *mode);
331int _win_open(const char *filename, int oflag, ...); 332 DIR *_win_opendir (const char *dirname);
333 int _win_open (const char *filename, int oflag, ...);
332#ifdef ENABLE_NLS 334#ifdef ENABLE_NLS
333char *_win_bindtextdomain(const char *domainname, const char *dirname); 335 char *_win_bindtextdomain (const char *domainname, const char *dirname);
334#endif 336#endif
335int _win_chdir(const char *path); 337 int _win_chdir (const char *path);
336int _win_close(int fd); 338 int _win_close (int fd);
337int _win_creat(const char *path, mode_t mode); 339 int _win_creat (const char *path, mode_t mode);
338int _win_fstat(int handle, struct stat *buffer); 340 int _win_fstat (int handle, struct stat *buffer);
339int _win_pipe(int *phandles); 341 int _win_pipe (int *phandles);
340int _win_rmdir(const char *path); 342 int _win_rmdir (const char *path);
341int _win_access( const char *path, int mode ); 343 int _win_access (const char *path, int mode);
342int _win_chmod(const char *filename, int pmode); 344 int _win_chmod (const char *filename, int pmode);
343char *realpath(const char *file_name, char *resolved_name); 345 char *realpath (const char *file_name, char *resolved_name);
344long _win_random(void); 346 long _win_random (void);
345int _win_remove(const char *path); 347 int _win_remove (const char *path);
346int _win_rename(const char *oldname, const char *newname); 348 int _win_rename (const char *oldname, const char *newname);
347int _win_stat(const char *path, struct stat *buffer); 349 int _win_stat (const char *path, struct stat *buffer);
348int _win_unlink(const char *filename); 350 int _win_unlink (const char *filename);
349int _win_write(int fildes, const void *buf, size_t nbyte); 351 int _win_write (int fildes, const void *buf, size_t nbyte);
350int _win_read(int fildes, void *buf, size_t nbyte); 352 int _win_read (int fildes, void *buf, size_t nbyte);
351size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE *stream); 353 size_t _win_fwrite (const void *buffer, size_t size, size_t count,
352size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream ); 354 FILE * stream);
353int _win_symlink(const char *path1, const char *path2); 355 size_t _win_fread (void *buffer, size_t size, size_t count, FILE * stream);
354void *_win_mmap(void *start, size_t len, int access, int flags, int fd, 356 int _win_symlink (const char *path1, const char *path2);
355 unsigned long long offset); 357 void *_win_mmap (void *start, size_t len, int access, int flags, int fd,
356int _win_munmap(void *start, size_t length); 358 unsigned long long offset);
357int _win_lstat(const char *path, struct stat *buf); 359 int _win_munmap (void *start, size_t length);
358int _win_readlink(const char *path, char *buf, size_t bufsize); 360 int _win_lstat (const char *path, struct stat *buf);
359int _win_accept(SOCKET s, struct sockaddr *addr, int *addrlen); 361 int _win_readlink (const char *path, char *buf, size_t bufsize);
360int _win_printf(const char *format,...); 362 int _win_accept (SOCKET s, struct sockaddr *addr, int *addrlen);
361int _win_fprintf(FILE *f,const char *format,...); 363 int _win_printf (const char *format, ...);
362int _win_vprintf(const char *format, va_list ap); 364 int _win_fprintf (FILE * f, const char *format, ...);
363int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); 365 int _win_vprintf (const char *format, va_list ap);
364int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); 366 int _win_vfprintf (FILE * stream, const char *format, va_list arg_ptr);
365int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); 367 int _win_vsprintf (char *dest, const char *format, va_list arg_ptr);
366int _win_snprintf(char *str,size_t size,const char *format,...); 368 int _win_vsnprintf (char *str, size_t size, const char *format,
367int _win_sprintf(char *dest,const char *format,...); 369 va_list arg_ptr);
368int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); 370 int _win_snprintf (char *str, size_t size, const char *format, ...);
369int _win_sscanf(const char *str, const char *format, ...); 371 int _win_sprintf (char *dest, const char *format, ...);
370int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); 372 int _win_vsscanf (const char *str, const char *format, va_list arg_ptr);
371int _win_vscanf(const char *format, va_list arg_ptr); 373 int _win_sscanf (const char *str, const char *format, ...);
372int _win_scanf(const char *format, ...); 374 int _win_vfscanf (FILE * stream, const char *format, va_list arg_ptr);
373int _win_fscanf(FILE *stream, const char *format, ...); 375 int _win_vscanf (const char *format, va_list arg_ptr);
374pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); 376 int _win_scanf (const char *format, ...);
375int _win_bind(SOCKET s, const struct sockaddr *name, int namelen); 377 int _win_fscanf (FILE * stream, const char *format, ...);
376int _win_connect(SOCKET s,const struct sockaddr *name, int namelen); 378 pid_t _win_waitpid (pid_t pid, int *stat_loc, int options);
377int _win_getpeername(SOCKET s, struct sockaddr *name, 379 int _win_bind (SOCKET s, const struct sockaddr *name, int namelen);
378 int *namelen); 380 int _win_connect (SOCKET s, const struct sockaddr *name, int namelen);
379int _win_getsockname(SOCKET s, struct sockaddr *name, 381 int _win_getpeername (SOCKET s, struct sockaddr *name, int *namelen);
380 int *namelen); 382 int _win_getsockname (SOCKET s, struct sockaddr *name, int *namelen);
381int _win_getsockopt(SOCKET s, int level, int optname, char *optval, 383 int _win_getsockopt (SOCKET s, int level, int optname, char *optval,
382 int *optlen); 384 int *optlen);
383int _win_listen(SOCKET s, int backlog); 385 int _win_listen (SOCKET s, int backlog);
384int _win_recv(SOCKET s, char *buf, int len, int flags); 386 int _win_recv (SOCKET s, char *buf, int len, int flags);
385int _win_recvfrom(SOCKET s, void *buf, int len, int flags, 387 int _win_recvfrom (SOCKET s, void *buf, int len, int flags,
386 struct sockaddr *from, int *fromlen); 388 struct sockaddr *from, int *fromlen);
387int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, 389 int _win_select (int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds,
388 const struct timeval *tv); 390 const struct timeval *tv);
389int _win_send(SOCKET s, const char *buf, int len, int flags); 391 int _win_send (SOCKET s, const char *buf, int len, int flags);
390int _win_sendto(SOCKET s, const char *buf, int len, int flags, 392 int _win_sendto (SOCKET s, const char *buf, int len, int flags,
391 const struct sockaddr *to, int tolen); 393 const struct sockaddr *to, int tolen);
392int _win_setsockopt(SOCKET s, int level, int optname, const void *optval, 394 int _win_setsockopt (SOCKET s, int level, int optname, const void *optval,
393 int optlen); 395 int optlen);
394int _win_shutdown(SOCKET s, int how); 396 int _win_shutdown (SOCKET s, int how);
395SOCKET _win_socket(int af, int type, int protocol); 397 SOCKET _win_socket (int af, int type, int protocol);
396struct hostent *_win_gethostbyaddr(const char *addr, int len, int type); 398 struct hostent *_win_gethostbyaddr (const char *addr, int len, int type);
397struct hostent *_win_gethostbyname(const char *name); 399 struct hostent *_win_gethostbyname (const char *name);
398char *_win_strerror(int errnum); 400 char *_win_strerror (int errnum);
399int IsWinNT(); 401 int IsWinNT ();
400 402
401#if !HAVE_STRNDUP 403#if !HAVE_STRNDUP
402char *strndup (const char *s, size_t n); 404 char *strndup (const char *s, size_t n);
403#endif 405#endif
404#if !HAVE_STRNLEN 406#if !HAVE_STRNLEN
405size_t strnlen (const char *str, size_t maxlen); 407 size_t strnlen (const char *str, size_t maxlen);
406#endif 408#endif
407 409
408#endif /* WINDOWS */ 410#endif /* WINDOWS */
409 411
410#ifndef WINDOWS 412#ifndef WINDOWS
411 #define DIR_SEPARATOR '/' 413#define DIR_SEPARATOR '/'
412 #define DIR_SEPARATOR_STR "/" 414#define DIR_SEPARATOR_STR "/"
413 #define NEWLINE "\n" 415#define NEWLINE "\n"
414 416
415#ifdef ENABLE_NLS 417#ifdef ENABLE_NLS
416 #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) 418#define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n)
417#endif 419#endif
418 #define CREAT(p, m) creat(p, m) 420#define CREAT(p, m) creat(p, m)
419 #undef FOPEN 421#undef FOPEN
420 #define FOPEN(f, m) fopen(f, m) 422#define FOPEN(f, m) fopen(f, m)
421 #define OPENDIR(d) opendir(d) 423#define OPENDIR(d) opendir(d)
422 #define OPEN(f) open(f) 424#define OPEN(f) open(f)
423 #define CHDIR(d) chdir(d) 425#define CHDIR(d) chdir(d)
424 #define CLOSE(f) close(f) 426#define CLOSE(f) close(f)
425 #define RMDIR(f) rmdir(f) 427#define RMDIR(f) rmdir(f)
426 #define ACCESS(p, m) access(p, m) 428#define ACCESS(p, m) access(p, m)
427 #define CHMOD(f, p) chmod(f, p) 429#define CHMOD(f, p) chmod(f, p)
428 #define FSTAT(h, b) fstat(h, b) 430#define FSTAT(h, b) fstat(h, b)
429 #define PIPE(h) pipe(h) 431#define PIPE(h) pipe(h)
430 #define REMOVE(p) remove(p) 432#define REMOVE(p) remove(p)
431 #define RENAME(o, n) rename(o, n) 433#define RENAME(o, n) rename(o, n)
432 #define STAT(p, b) stat(p, b) 434#define STAT(p, b) stat(p, b)
433 #define UNLINK(f) unlink(f) 435#define UNLINK(f) unlink(f)
434 #define WRITE(f, b, n) write(f, b, n) 436#define WRITE(f, b, n) write(f, b, n)
435 #define READ(f, b, n) read(f, b, n) 437#define READ(f, b, n) read(f, b, n)
436 #define GN_FREAD(b, s, c, f) fread(b, s, c, f) 438#define GN_FREAD(b, s, c, f) fread(b, s, c, f)
437 #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) 439#define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f)
438 #define SYMLINK(a, b) symlink(a, b) 440#define SYMLINK(a, b) symlink(a, b)
439 #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) 441#define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o)
440 #define MUNMAP(s, l) munmap(s, l) 442#define MUNMAP(s, l) munmap(s, l)
441 #define STRERROR(i) strerror(i) 443#define STRERROR(i) strerror(i)
442 #define RANDOM() random() 444#define RANDOM() random()
443 #define READLINK(p, b, s) readlink(p, b, s) 445#define READLINK(p, b, s) readlink(p, b, s)
444 #define LSTAT(p, b) lstat(p, b) 446#define LSTAT(p, b) lstat(p, b)
445 #define PRINTF printf 447#define PRINTF printf
446 #define FPRINTF fprintf 448#define FPRINTF fprintf
447 #define VPRINTF(f, a) vprintf(f, a) 449#define VPRINTF(f, a) vprintf(f, a)
448 #define VFPRINTF(s, f, a) vfprintf(s, f, a) 450#define VFPRINTF(s, f, a) vfprintf(s, f, a)
449 #define VSPRINTF(d, f, a) vsprintf(d, f, a) 451#define VSPRINTF(d, f, a) vsprintf(d, f, a)
450 #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) 452#define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a)
451 #define _REAL_SNPRINTF snprintf 453#define _REAL_SNPRINTF snprintf
452 #define SPRINTF sprintf 454#define SPRINTF sprintf
453 #define VSSCANF(s, f, a) vsscanf(s, f, a) 455#define VSSCANF(s, f, a) vsscanf(s, f, a)
454 #define SSCANF sscanf 456#define SSCANF sscanf
455 #define VFSCANF(s, f, a) vfscanf(s, f, a) 457#define VFSCANF(s, f, a) vfscanf(s, f, a)
456 #define VSCANF(f, a) vscanf(f, a) 458#define VSCANF(f, a) vscanf(f, a)
457 #define SCANF scanf 459#define SCANF scanf
458 #define FSCANF fscanf 460#define FSCANF fscanf
459 #define WAITPID(p, s, o) waitpid(p, s, o) 461#define WAITPID(p, s, o) waitpid(p, s, o)
460 #define ACCEPT(s, a, l) accept(s, a, l) 462#define ACCEPT(s, a, l) accept(s, a, l)
461 #define BIND(s, n, l) bind(s, n, l) 463#define BIND(s, n, l) bind(s, n, l)
462 #define CONNECT(s, n, l) connect(s, n, l) 464#define CONNECT(s, n, l) connect(s, n, l)
463 #define GETPEERNAME(s, n, l) getpeername(s, n, l) 465#define GETPEERNAME(s, n, l) getpeername(s, n, l)
464 #define GETSOCKNAME(s, n, l) getsockname(s, n, l) 466#define GETSOCKNAME(s, n, l) getsockname(s, n, l)
465 #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) 467#define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p)
466 #define LISTEN(s, b) listen(s, b) 468#define LISTEN(s, b) listen(s, b)
467 #define RECV(s, b, l, f) recv(s, b, l, f) 469#define RECV(s, b, l, f) recv(s, b, l, f)
468 #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) 470#define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o)
469 #define SELECT(n, r, w, e, t) select(n, r, w, e, t) 471#define SELECT(n, r, w, e, t) select(n, r, w, e, t)
470 #define SEND(s, b, l, f) send(s, b, l, f) 472#define SEND(s, b, l, f) send(s, b, l, f)
471 #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) 473#define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n)
472 #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) 474#define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n)
473 #define SHUTDOWN(s, h) shutdown(s, h) 475#define SHUTDOWN(s, h) shutdown(s, h)
474 #define SOCKET(a, t, p) socket(a, t, p) 476#define SOCKET(a, t, p) socket(a, t, p)
475 #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) 477#define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t)
476 #define GETHOSTBYNAME(n) gethostbyname(n) 478#define GETHOSTBYNAME(n) gethostbyname(n)
477#else 479#else
478 #define DIR_SEPARATOR '\\' 480#define DIR_SEPARATOR '\\'
479 #define DIR_SEPARATOR_STR "\\" 481#define DIR_SEPARATOR_STR "\\"
480 #define NEWLINE "\r\n" 482#define NEWLINE "\r\n"
481 483
482#ifdef ENABLE_NLS 484#ifdef ENABLE_NLS
483 #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) 485#define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n)
484#endif 486#endif
485 #define CREAT(p, m) _win_creat(p, m) 487#define CREAT(p, m) _win_creat(p, m)
486 #define FOPEN(f, m) _win_fopen(f, m) 488#define FOPEN(f, m) _win_fopen(f, m)
487 #define OPENDIR(d) _win_opendir(d) 489#define OPENDIR(d) _win_opendir(d)
488 #define OPEN(f) _win_open(f) 490#define OPEN(f) _win_open(f)
489 #define CHDIR(d) _win_chdir(d) 491#define CHDIR(d) _win_chdir(d)
490 #define CLOSE(f) _win_close(f) 492#define CLOSE(f) _win_close(f)
491 #define FSTAT(h, b) _win_fstat(h, b) 493#define FSTAT(h, b) _win_fstat(h, b)
492 #define RMDIR(f) _win_rmdir(f) 494#define RMDIR(f) _win_rmdir(f)
493 #define ACCESS(p, m) _win_access(p, m) 495#define ACCESS(p, m) _win_access(p, m)
494 #define CHMOD(f, p) _win_chmod(f, p) 496#define CHMOD(f, p) _win_chmod(f, p)
495 #define PIPE(h) _win_pipe(h) 497#define PIPE(h) _win_pipe(h)
496 #define RANDOM() _win_random() 498#define RANDOM() _win_random()
497 #define REMOVE(p) _win_remove(p) 499#define REMOVE(p) _win_remove(p)
498 #define RENAME(o, n) _win_rename(o, n) 500#define RENAME(o, n) _win_rename(o, n)
499 #define STAT(p, b) _win_stat(p, b) 501#define STAT(p, b) _win_stat(p, b)
500 #define UNLINK(f) _win_unlink(f) 502#define UNLINK(f) _win_unlink(f)
501 #define WRITE(f, b, n) _win_write(f, b, n) 503#define WRITE(f, b, n) _win_write(f, b, n)
502 #define READ(f, b, n) _win_read(f, b, n) 504#define READ(f, b, n) _win_read(f, b, n)
503 #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) 505#define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f)
504 #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) 506#define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
505 #define SYMLINK(a, b) _win_symlink(a, b) 507#define SYMLINK(a, b) _win_symlink(a, b)
506 #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) 508#define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
507 #define MUNMAP(s, l) _win_munmap(s, l) 509#define MUNMAP(s, l) _win_munmap(s, l)
508 #define STRERROR(i) _win_strerror(i) 510#define STRERROR(i) _win_strerror(i)
509 #define READLINK(p, b, s) _win_readlink(p, b, s) 511#define READLINK(p, b, s) _win_readlink(p, b, s)
510 #define LSTAT(p, b) _win_lstat(p, b) 512#define LSTAT(p, b) _win_lstat(p, b)
511 #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) 513#define PRINTF(f, ...) _win_printf(f , __VA_ARGS__)
512 #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) 514#define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__)
513 #define VPRINTF(f, a) _win_vprintf(f, a) 515#define VPRINTF(f, a) _win_vprintf(f, a)
514 #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) 516#define VFPRINTF(s, f, a) _win_vfprintf(s, f, a)
515 #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) 517#define VSPRINTF(d, f, a) _win_vsprintf(d, f, a)
516 #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) 518#define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a)
517 #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) 519#define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__)
518 #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) 520#define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__)
519 #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) 521#define VSSCANF(s, f, a) _win_vsscanf(s, f, a)
520 #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) 522#define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__)
521 #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) 523#define VFSCANF(s, f, a) _win_vfscanf(s, f, a)
522 #define VSCANF(f, a) _win_vscanf(f, a) 524#define VSCANF(f, a) _win_vscanf(f, a)
523 #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) 525#define SCANF(f, ...) _win_scanf(f, __VA_ARGS__)
524 #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) 526#define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__)
525 #define WAITPID(p, s, o) _win_waitpid(p, s, o) 527#define WAITPID(p, s, o) _win_waitpid(p, s, o)
526 #define ACCEPT(s, a, l) _win_accept(s, a, l) 528#define ACCEPT(s, a, l) _win_accept(s, a, l)
527 #define BIND(s, n, l) _win_bind(s, n, l) 529#define BIND(s, n, l) _win_bind(s, n, l)
528 #define CONNECT(s, n, l) _win_connect(s, n, l) 530#define CONNECT(s, n, l) _win_connect(s, n, l)
529 #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) 531#define GETPEERNAME(s, n, l) _win_getpeername(s, n, l)
530 #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) 532#define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l)
531 #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) 533#define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p)
532 #define LISTEN(s, b) _win_listen(s, b) 534#define LISTEN(s, b) _win_listen(s, b)
533 #define RECV(s, b, l, f) _win_recv(s, b, l, f) 535#define RECV(s, b, l, f) _win_recv(s, b, l, f)
534 #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) 536#define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o)
535 #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) 537#define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t)
536 #define SEND(s, b, l, f) _win_send(s, b, l, f) 538#define SEND(s, b, l, f) _win_send(s, b, l, f)
537 #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) 539#define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n)
538 #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) 540#define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n)
539 #define SHUTDOWN(s, h) _win_shutdown(s, h) 541#define SHUTDOWN(s, h) _win_shutdown(s, h)
540 #define SOCKET(a, t, p) _win_socket(a, t, p) 542#define SOCKET(a, t, p) _win_socket(a, t, p)
541 #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) 543#define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t)
542 #define GETHOSTBYNAME(n) _win_gethostbyname(n) 544#define GETHOSTBYNAME(n) _win_gethostbyname(n)
543#endif 545#endif
544 546
545 547
@@ -548,6 +550,6 @@ size_t strnlen (const char *str, size_t maxlen);
548#endif 550#endif
549 551
550 552
551#endif //_PLIBC_H_ 553#endif //_PLIBC_H_
552 554
553/* end of plibc.h */ 555/* end of plibc.h */