aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2014-02-18 18:40:59 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2014-02-18 18:40:59 +0000
commitceae73d954b01e91c5c2f027a9ce67c7bb05a767 (patch)
tree47fdc26405197daf951623f0183d97ffa396563a
parent41e5c4888a6e5a87dfcd75f4b76e6e6f2e6cb280 (diff)
downloadlibmicrohttpd-ceae73d954b01e91c5c2f027a9ce67c7bb05a767.tar.gz
libmicrohttpd-ceae73d954b01e91c5c2f027a9ce67c7bb05a767.zip
Remove PlibC files
-rw-r--r--src/include/plibc/Makefile.am3
-rw-r--r--src/include/plibc/plibc.h997
2 files changed, 0 insertions, 1000 deletions
diff --git a/src/include/plibc/Makefile.am b/src/include/plibc/Makefile.am
deleted file mode 100644
index ecfd4c6a..00000000
--- a/src/include/plibc/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
1SUBDIRS = .
2
3EXTRA_DIST = plibc.h
diff --git a/src/include/plibc/plibc.h b/src/include/plibc/plibc.h
deleted file mode 100644
index 6ee3fa5b..00000000
--- a/src/include/plibc/plibc.h
+++ /dev/null
@@ -1,997 +0,0 @@
1/*
2 This file is part of PlibC.
3 (C) 2005, 2006, 2007, 2008, 2009, 2010 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$
26 */
27
28#ifndef _PLIBC_H_
29#define _PLIBC_H_
30
31#ifndef SIGALRM
32 #define SIGALRM 14
33#endif
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#include <stddef.h>
40
41#ifdef Q_OS_WIN32
42 #define WINDOWS 1
43#endif
44
45#define HAVE_PLIBC_FD 0
46
47#ifdef WINDOWS
48
49#if ENABLE_NLS
50 #include "langinfo.h"
51#endif
52
53#include <ws2tcpip.h>
54#include <windows.h>
55#include <sys/types.h>
56#include <time.h>
57#include <stdio.h>
58#include <sys/types.h>
59#include <sys/stat.h>
60#include <dirent.h>
61#include <errno.h>
62#include <stdarg.h>
63
64#define __BYTE_ORDER BYTE_ORDER
65#define __BIG_ENDIAN BIG_ENDIAN
66
67/* Conflicts with our definitions */
68#define __G_WIN32_H__
69
70/* Convert LARGE_INTEGER to double */
71#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \
72 (double)((x).LowPart))
73#ifndef __MINGW64_VERSION_MAJOR
74struct _stati64
75{
76 _dev_t st_dev;
77 _ino_t st_ino;
78 _mode_t st_mode;
79 short st_nlink;
80 short st_uid;
81 short st_gid;
82 _dev_t st_rdev;
83 __int64 st_size;
84 time_t st_atime;
85 time_t st_mtime;
86 time_t st_ctime;
87};
88#endif
89typedef unsigned int sa_family_t;
90
91struct sockaddr_un {
92 short sun_family; /*AF_UNIX*/
93 char sun_path[108]; /*path name */
94};
95
96#ifndef pid_t
97 #define pid_t DWORD
98#endif
99
100#ifndef error_t
101 #define error_t int
102#endif
103
104#ifndef WEXITSTATUS
105 #define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
106#endif
107
108#ifndef MSG_DONTWAIT
109 #define MSG_DONTWAIT 0
110#endif
111
112enum
113{
114 _SC_PAGESIZE = 30,
115 _SC_PAGE_SIZE = 30
116};
117
118#if !defined(EACCESS)
119# define EACCESS EACCES
120#endif
121
122/* Thanks to the Cygwin project */
123#if !defined(ENOCSI)
124# define ENOCSI 43 /* No CSI structure available */
125#endif
126#if !defined(EL2HLT)
127# define EL2HLT 44 /* Level 2 halted */
128#endif
129#if !defined(EDEADLK)
130# define EDEADLK 45 /* Deadlock condition */
131#endif
132#if !defined(ENOLCK)
133# define ENOLCK 46 /* No record locks available */
134#endif
135#if !defined(EBADE)
136# define EBADE 50 /* Invalid exchange */
137#endif
138#if !defined(EBADR)
139# define EBADR 51 /* Invalid request descriptor */
140#endif
141#if !defined(EXFULL)
142# define EXFULL 52 /* Exchange full */
143#endif
144#if !defined(ENOANO)
145# define ENOANO 53 /* No anode */
146#endif
147#if !defined(EBADRQC)
148# define EBADRQC 54 /* Invalid request code */
149#endif
150#if !defined(EBADSLT)
151# define EBADSLT 55 /* Invalid slot */
152#endif
153#if !defined(EDEADLOCK)
154# define EDEADLOCK EDEADLK /* File locking deadlock error */
155#endif
156#if !defined(EBFONT)
157# define EBFONT 57 /* Bad font file fmt */
158#endif
159#if !defined(ENOSTR)
160# define ENOSTR 60 /* Device not a stream */
161#endif
162#if !defined(ENODATA)
163# define ENODATA 61 /* No data (for no delay io) */
164#endif
165#if !defined(ETIME)
166# define ETIME 62 /* Timer expired */
167#endif
168#if !defined(ENOSR)
169# define ENOSR 63 /* Out of streams resources */
170#endif
171#if !defined(ENONET)
172# define ENONET 64 /* Machine is not on the network */
173#endif
174#if !defined(ENOPKG)
175# define ENOPKG 65 /* Package not installed */
176#endif
177#if !defined(EREMOTE)
178# define EREMOTE 66 /* The object is remote */
179#endif
180#if !defined(ENOLINK)
181# define ENOLINK 67 /* The link has been severed */
182#endif
183#if !defined(EADV)
184# define EADV 68 /* Advertise error */
185#endif
186#if !defined(ESRMNT)
187# define ESRMNT 69 /* Srmount error */
188#endif
189#if !defined(ECOMM)
190# define ECOMM 70 /* Communication error on send */
191#endif
192#if !defined(EMULTIHOP)
193# define EMULTIHOP 74 /* Multihop attempted */
194#endif
195#if !defined(ELBIN)
196# define ELBIN 75 /* Inode is remote (not really error) */
197#endif
198#if !defined(EDOTDOT)
199# define EDOTDOT 76 /* Cross mount point (not really error) */
200#endif
201#if !defined(EBADMSG)
202# define EBADMSG 77 /* Trying to read unreadable message */
203#endif
204#if !defined(ENOTUNIQ)
205# define ENOTUNIQ 80 /* Given log. name not unique */
206#endif
207#if !defined(EBADFD)
208# define EBADFD 81 /* f.d. invalid for this operation */
209#endif
210#if !defined(EREMCHG)
211# define EREMCHG 82 /* Remote address changed */
212#endif
213#if !defined(ELIBACC)
214# define ELIBACC 83 /* Can't access a needed shared lib */
215#endif
216#if !defined(ELIBBAD)
217# define ELIBBAD 84 /* Accessing a corrupted shared lib */
218#endif
219#if !defined(ELIBSCN)
220# define ELIBSCN 85 /* .lib section in a.out corrupted */
221#endif
222#if !defined(ELIBMAX)
223# define ELIBMAX 86 /* Attempting to link in too many libs */
224#endif
225#if !defined(ELIBEXEC)
226# define ELIBEXEC 87 /* Attempting to exec a shared library */
227#endif
228#if !defined(ENOSYS)
229# define ENOSYS 88 /* Function not implemented */
230#endif
231#if !defined(ENMFILE)
232# define ENMFILE 89 /* No more files */
233#endif
234#if !defined(ENOTEMPTY)
235# define ENOTEMPTY 90 /* Directory not empty */
236#endif
237#if !defined(ENAMETOOLONG)
238# define ENAMETOOLONG 91 /* File or path name too long */
239#endif
240#if !defined(EPFNOSUPPORT)
241# define EPFNOSUPPORT 96 /* Protocol family not supported */
242#endif
243#if !defined(ENOSHARE)
244# define ENOSHARE 97 /* No such host or network path */
245#endif
246#if !defined(ENOMEDIUM)
247# define ENOMEDIUM 98 /* No medium (in tape drive) */
248#endif
249#if !defined(ESHUTDOWN)
250# define ESHUTDOWN 99 /* Can't send after socket shutdown */
251#endif
252#if !defined(EADDRINUSE)
253# define EADDRINUSE 100 /* Address already in use */
254#endif
255#if !defined(EADDRNOTAVAIL)
256# define EADDRNOTAVAIL 101 /* Address not available */
257#endif
258#if !defined(EAFNOSUPPORT)
259# define EAFNOSUPPORT 102 /* Address family not supported by protocol family */
260#endif
261#if !defined(EALREADY)
262# define EALREADY 103 /* Socket already connected */
263#endif
264#if !defined(ECANCELED)
265# define ECANCELED 105 /* Connection cancelled */
266#endif
267#if !defined(ECONNABORTED)
268# define ECONNABORTED 106 /* Connection aborted */
269#endif
270#if !defined(ECONNREFUSED)
271# define ECONNREFUSED 107 /* Connection refused */
272#endif
273#if !defined(ECONNRESET)
274# define ECONNRESET 108 /* Connection reset by peer */
275#endif
276#if !defined(EDESTADDRREQ)
277# define EDESTADDRREQ 109 /* Destination address required */
278#endif
279#if !defined(EHOSTUNREACH)
280# define EHOSTUNREACH 110 /* Host is unreachable */
281#endif
282#if !defined(ECONNABORTED)
283# define ECONNABORTED 111 /* Connection aborted */
284#endif
285#if !defined(EINPROGRESS)
286# define EINPROGRESS 112 /* Connection already in progress */
287#endif
288#if !defined(EISCONN)
289# define EISCONN 113 /* Socket is already connected */
290#endif
291#if !defined(ELOOP)
292# define ELOOP 114 /* Too many symbolic links */
293#endif
294#if !defined(EMSGSIZE)
295# define EMSGSIZE 115 /* Message too long */
296#endif
297#if !defined(ENETDOWN)
298# define ENETDOWN 116 /* Network interface is not configured */
299#endif
300#if !defined(ENETRESET)
301# define ENETRESET 117 /* Connection aborted by network */
302#endif
303#if !defined(ENETUNREACH)
304# define ENETUNREACH 118 /* Network is unreachable */
305#endif
306#if !defined(ENOBUFS)
307# define ENOBUFS 119 /* No buffer space available */
308#endif
309#if !defined(EHOSTDOWN)
310# define EHOSTDOWN 120 /* Host is down */
311#endif
312#if !defined(EPROCLIM)
313# define EPROCLIM 121 /* Too many processes */
314#endif
315#if !defined(EDQUOT)
316# define EDQUOT 122 /* Disk quota exceeded */
317#endif
318#if !defined(ENOPROTOOPT)
319# define ENOPROTOOPT 123 /* Protocol not available */
320#endif
321#if !defined(ESOCKTNOSUPPORT)
322# define ESOCKTNOSUPPORT 124 /* Socket type not supported */
323#endif
324#if !defined(ESTALE)
325# define ESTALE 125 /* Unknown error */
326#endif
327#if !defined(ENOTCONN)
328# define ENOTCONN 126 /* Socket is not connected */
329#endif
330#if !defined(ETOOMANYREFS)
331# define ETOOMANYREFS 127 /* Too many references: cannot splice */
332#endif
333#if !defined(ENOTSOCK)
334# define ENOTSOCK 128 /* Socket operation on non-socket */
335#endif
336#if !defined(ENOTSUP)
337# define ENOTSUP 129 /* Not supported */
338#endif
339#if !defined(EOPNOTSUPP)
340# define EOPNOTSUPP 130 /* Operation not supported on transport endpoint */
341#endif
342#if !defined(EUSERS)
343# define EUSERS 131 /* Too many users */
344#endif
345#if !defined(EOVERFLOW)
346# define EOVERFLOW 132 /* Value too large for defined data type */
347#endif
348#if !defined(EOWNERDEAD)
349# define EOWNERDEAD 133 /* Unknown error */
350#endif
351#if !defined(EPROTO)
352# define EPROTO 134 /* Protocol error */
353#endif
354#if !defined(EPROTONOSUPPORT)
355# define EPROTONOSUPPORT 135 /* Unknown protocol */
356#endif
357#if !defined(EPROTOTYPE)
358# define EPROTOTYPE 136 /* Protocol wrong type for socket */
359#endif
360#if !defined(ECASECLASH)
361# define ECASECLASH 137 /* Filename exists with different case */
362#endif
363#if !defined(ETIMEDOUT)
364/* Make sure it's the same as WSATIMEDOUT */
365# define ETIMEDOUT 138 /* Connection timed out */
366#endif
367#if !defined(EWOULDBLOCK) || EWOULDBLOCK == 140
368# undef EWOULDBLOCK /* MinGW-w64 defines it as 140, but we want it as EAGAIN */
369# define EWOULDBLOCK EAGAIN /* Operation would block */
370#endif
371
372#undef HOST_NOT_FOUND
373#define HOST_NOT_FOUND 1
374#undef TRY_AGAIN
375#define TRY_AGAIN 2
376#undef NO_RECOVERY
377#define NO_RECOVERY 3
378#undef NO_ADDRESS
379#define NO_ADDRESS 4
380
381#define PROT_READ 0x1
382#define PROT_WRITE 0x2
383#define MAP_SHARED 0x1
384#define MAP_PRIVATE 0x2 /* unsupported */
385#define MAP_FIXED 0x10
386#define MAP_ANONYMOUS 0x20 /* unsupported */
387#define MAP_FAILED ((void *)-1)
388
389#define MS_ASYNC 1 /* sync memory asynchronously */
390#define MS_INVALIDATE 2 /* invalidate the caches */
391#define MS_SYNC 4 /* synchronous memory sync */
392
393struct statfs
394{
395 long f_type; /* type of filesystem (see below) */
396 long f_bsize; /* optimal transfer block size */
397 long f_blocks; /* total data blocks in file system */
398 long f_bfree; /* free blocks in fs */
399 long f_bavail; /* free blocks avail to non-superuser */
400 long f_files; /* total file nodes in file system */
401 long f_ffree; /* free file nodes in fs */
402 long f_fsid; /* file system id */
403 long f_namelen; /* maximum length of filenames */
404 long f_spare[6]; /* spare for later */
405};
406
407/* Taken from the Wine project <http://www.winehq.org>
408 /wine/include/winternl.h */
409enum SYSTEM_INFORMATION_CLASS
410{
411 SystemBasicInformation = 0,
412 Unknown1,
413 SystemPerformanceInformation = 2,
414 SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */
415 Unknown4,
416 SystemProcessInformation = 5,
417 Unknown6,
418 Unknown7,
419 SystemProcessorPerformanceInformation = 8,
420 Unknown9,
421 Unknown10,
422 SystemDriverInformation,
423 Unknown12,
424 Unknown13,
425 Unknown14,
426 Unknown15,
427 SystemHandleList,
428 Unknown17,
429 Unknown18,
430 Unknown19,
431 Unknown20,
432 SystemCacheInformation,
433 Unknown22,
434 SystemInterruptInformation = 23,
435 SystemExceptionInformation = 33,
436 SystemRegistryQuotaInformation = 37,
437 SystemLookasideInformation = 45
438};
439
440typedef struct
441{
442 LARGE_INTEGER IdleTime;
443 LARGE_INTEGER KernelTime;
444 LARGE_INTEGER UserTime;
445 LARGE_INTEGER Reserved1[2];
446 ULONG Reserved2;
447} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
448
449#define sleep(secs) (Sleep(secs * 1000))
450
451/*********************** statfs *****************************/
452/* fake block size */
453#define FAKED_BLOCK_SIZE 512
454
455/* linux-compatible values for fs type */
456#define MSDOS_SUPER_MAGIC 0x4d44
457#define NTFS_SUPER_MAGIC 0x5346544E
458
459/*********************** End of statfs ***********************/
460
461#define SHUT_RDWR SD_BOTH
462
463/* Operations for flock() */
464#define LOCK_SH 1 /* shared lock */
465#define LOCK_EX 2 /* exclusive lock */
466#define LOCK_NB 4 /* or'd with one of the above to prevent
467 blocking */
468#define LOCK_UN 8 /* remove lock */
469
470/* Not supported under MinGW */
471#define S_IRGRP 0
472#define S_IWGRP 0
473#define S_IROTH 0
474#define S_IXGRP 0
475#define S_IWOTH 0
476#define S_IXOTH 0
477#define S_ISUID 0
478#define S_ISGID 0
479#define S_ISVTX 0
480#define S_IRWXG 0
481#define S_IRWXO 0
482
483#define SHUT_WR SD_SEND
484#define SHUT_RD SD_RECEIVE
485#define SHUT_RDWR SD_BOTH
486
487#define SIGKILL 9
488#define SIGTERM 15
489
490#define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__)
491
492BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest);
493BOOL _plibc_CreateShortcutW(const wchar_t *pwszSrc, const wchar_t *pwszDest);
494BOOL _plibc_DereferenceShortcut(char *pszShortcut);
495BOOL _plibc_DereferenceShortcutW(wchar_t *pwszShortcut);
496char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags);
497wchar_t *plibc_ChooseDirW(wchar_t *pwszTitle, unsigned long ulFlags);
498char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags);
499wchar_t *plibc_ChooseFileW(wchar_t *pwszTitle, unsigned long ulFlags);
500
501long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey,
502 char *pszBuffer, long *pdLength);
503long QueryRegistryW(HKEY hMainKey, const wchar_t *pszKey, const wchar_t *pszSubKey,
504 wchar_t *pszBuffer, long *pdLength);
505
506BOOL __win_IsHandleMarkedAsBlocking(int hHandle);
507void __win_SetHandleBlockingMode(int s, BOOL bBlocking);
508void __win_DiscardHandleBlockingMode(int s);
509int _win_isSocketValid(int s);
510int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows);
511int plibc_conv_to_win_pathw(const wchar_t *pszUnix, wchar_t *pwszWindows);
512
513int plibc_conv_to_win_pathwconv(const char *pszUnix, wchar_t *pwszWindows);
514int plibc_conv_to_win_pathwconv_ex(const char *pszUnix, wchar_t *pszWindows, int derefLinks);
515
516unsigned plibc_get_handle_count();
517
518typedef void (*TPanicProc) (int, char *);
519void plibc_set_panic_proc(TPanicProc proc);
520
521int flock(int fd, int operation);
522int fsync(int fildes);
523int inet_pton(int af, const char *src, void *dst);
524int inet_pton4(const char *src, u_char *dst, int pton);
525#if USE_IPV6
526int inet_pton6(const char *src, u_char *dst);
527#endif
528int statfs(const char *path, struct statfs *buf);
529const char *hstrerror(int err);
530int mkstemp(char *tmplate);
531char *strptime (const char *buf, const char *format, struct tm *tm);
532const char *inet_ntop(int af, const void *src, char *dst, size_t size);
533#ifndef gmtime_r
534struct tm *gmtime_r(const time_t *clock, struct tm *result);
535#endif
536
537int plibc_init(char *pszOrg, char *pszApp);
538int plibc_init_utf8(char *pszOrg, char *pszApp, int utf8_mode);
539void plibc_shutdown();
540int plibc_initialized();
541
542void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine);
543void SetErrnoFromWinsockError(long lWinError);
544void SetHErrnoFromWinError(long lWinError);
545void SetErrnoFromHRESULT(HRESULT hRes);
546int GetErrnoFromWinsockError(long lWinError);
547FILE *_win_fopen(const char *filename, const char *mode);
548int _win_fclose(FILE *);
549DIR *_win_opendir(const char *dirname);
550struct dirent *_win_readdir(DIR *dirp);
551int _win_closedir(DIR *dirp);
552int _win_open(const char *filename, int oflag, ...);
553#ifdef ENABLE_NLS
554char *_win_bindtextdomain(const char *domainname, const char *dirname);
555#endif
556int _win_chdir(const char *path);
557int _win_close(int fd);
558int _win_creat(const char *path, mode_t mode);
559char *_win_ctime(const time_t *clock);
560char *_win_ctime_r(const time_t *clock, char *buf);
561int _win_fstat(int handle, struct stat *buffer);
562int _win_ftruncate(int fildes, off_t length);
563int _win_truncate(const char *fname, int distance);
564int _win_kill(pid_t pid, int sig);
565int _win_pipe(int *phandles);
566intptr_t _win_mkfifo(const char *path, mode_t mode);
567int _win_rmdir(const char *path);
568int _win_access( const char *path, int mode );
569int _win_chmod(const char *filename, int pmode);
570char *realpath(const char *file_name, char *resolved_name);
571long _win_random(void);
572void _win_srandom(unsigned int seed);
573int _win_remove(const char *path);
574int _win_rename(const char *oldname, const char *newname);
575int _win_stat(const char *path, struct stat *buffer);
576int _win_stati64(const char *path, struct _stati64 *buffer);
577long _win_sysconf(int name);
578int _win_unlink(const char *filename);
579int _win_write(int fildes, const void *buf, size_t nbyte);
580int _win_read(int fildes, void *buf, size_t nbyte);
581size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE *stream);
582size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream );
583int _win_symlink(const char *path1, const char *path2);
584void *_win_mmap(void *start, size_t len, int access, int flags, int fd,
585 unsigned long long offset);
586int _win_msync(void *start, size_t length, int flags);
587int _win_munmap(void *start, size_t length);
588int _win_lstat(const char *path, struct stat *buf);
589int _win_lstati64(const char *path, struct _stati64 *buf);
590int _win_readlink(const char *path, char *buf, size_t bufsize);
591int _win_accept(int s, struct sockaddr *addr, int *addrlen);
592
593pid_t _win_waitpid(pid_t pid, int *stat_loc, int options);
594int _win_bind(int s, const struct sockaddr *name, int namelen);
595int _win_connect(int s,const struct sockaddr *name, int namelen);
596int _win_getpeername(int s, struct sockaddr *name,
597 int *namelen);
598int _win_getsockname(int s, struct sockaddr *name,
599 int *namelen);
600int _win_getsockopt(int s, int level, int optname, char *optval,
601 int *optlen);
602int _win_listen(int s, int backlog);
603int _win_recv(int s, char *buf, int len, int flags);
604int _win_recvfrom(int s, void *buf, int len, int flags,
605 struct sockaddr *from, int *fromlen);
606int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds,
607 const struct timeval *tv);
608int _win_send(int s, const char *buf, int len, int flags);
609int _win_sendto(int s, const char *buf, int len, int flags,
610 const struct sockaddr *to, int tolen);
611int _win_setsockopt(int s, int level, int optname, const void *optval,
612 int optlen);
613int _win_shutdown(int s, int how);
614int _win_socket(int af, int type, int protocol);
615int _win_socketpair(int af, int type, int protocol, int socket_vector[2]);
616struct hostent *_win_gethostbyaddr(const char *addr, int len, int type);
617struct hostent *_win_gethostbyname(const char *name);
618struct hostent *gethostbyname2(const char *name, int af);
619char *_win_strerror(int errnum);
620int IsWinNT();
621char *index(const char *s, int c);
622char *_win_strtok_r (char *ptr, const char *sep, char **end);
623
624#if !HAVE_STRNDUP
625char *strndup (const char *s, size_t n);
626#endif
627#if !HAVE_STRNLEN && (!defined(__MINGW64_VERSION_MAJOR) || !defined(_INC_STRING))
628size_t strnlen (const char *str, size_t maxlen);
629#endif
630char *stpcpy(char *dest, const char *src);
631char *strcasestr(const char *haystack_start, const char *needle_start);
632#ifndef __MINGW64_VERSION_MAJOR
633#define strcasecmp(a, b) stricmp(a, b)
634#define strncasecmp(a, b, c) strnicmp(a, b, c)
635#endif
636#ifndef wcscasecmp
637#define wcscasecmp(a, b) wcsicmp(a, b)
638#endif
639#ifndef wcsncasecmp
640#define wcsncasecmp(a, b, c) wcsnicmp(a, b, c)
641#endif
642#ifndef strtok_r /* winpthreads defines it in pthread.h */
643#define strtok_r _win_strtok_r
644#endif
645#endif /* WINDOWS */
646
647#ifndef WINDOWS
648 #define DIR_SEPARATOR '/'
649 #define DIR_SEPARATOR_STR "/"
650 #define PATH_SEPARATOR ':'
651 #define PATH_SEPARATOR_STR ":"
652 #define NEWLINE "\n"
653
654#ifdef ENABLE_NLS
655 #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n)
656#endif
657 #define CREAT(p, m) creat(p, m)
658 #define PLIBC_CTIME(c) ctime(c)
659 #define CTIME_R(c, b) ctime_r(c, b)
660 #undef FOPEN
661 #define FOPEN(f, m) fopen(f, m)
662 #define FCLOSE(f) fclose(f)
663 #define FTRUNCATE(f, l) ftruncate(f, l)
664 #define TRUNCATE(f, l) truncate(f, l)
665 #define OPENDIR(d) opendir(d)
666 #define CLOSEDIR(d) closedir(d)
667 #define READDIR(d) readdir(d)
668 #define OPEN open
669 #define CHDIR(d) chdir(d)
670 #define CLOSE(f) close(f)
671 #define LSEEK(f, o, w) lseek(f, o, w)
672 #define RMDIR(f) rmdir(f)
673 #define ACCESS(p, m) access(p, m)
674 #define CHMOD(f, p) chmod(f, p)
675 #define FSTAT(h, b) fstat(h, b)
676 #define PLIBC_KILL(p, s) kill(p, s)
677 #define PIPE(h) pipe(h)
678 #define REMOVE(p) remove(p)
679 #define RENAME(o, n) rename(o, n)
680 #define STAT(p, b) stat(p, b)
681 #define STAT64(p, b) stat64(p, b)
682 #define SYSCONF(n) sysconf(n)
683 #define UNLINK(f) unlink(f)
684 #define WRITE(f, b, n) write(f, b, n)
685 #define READ(f, b, n) read(f, b, n)
686 #define GN_FREAD(b, s, c, f) fread(b, s, c, f)
687 #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f)
688 #define SYMLINK(a, b) symlink(a, b)
689 #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o)
690 #define MKFIFO(p, m) mkfifo(p, m)
691 #define MSYNC(s, l, f) msync(s, l, f)
692 #define MUNMAP(s, l) munmap(s, l)
693 #define STRERROR(i) strerror(i)
694 #define RANDOM() random()
695 #define SRANDOM(s) srandom(s)
696 #define READLINK(p, b, s) readlink(p, b, s)
697 #define LSTAT(p, b) lstat(p, b)
698 #define LSTAT64(p, b) lstat64(p, b)
699 #define PRINTF printf
700 #define FPRINTF fprintf
701 #define VPRINTF(f, a) vprintf(f, a)
702 #define VFPRINTF(s, f, a) vfprintf(s, f, a)
703 #define VSPRINTF(d, f, a) vsprintf(d, f, a)
704 #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a)
705 #define _REAL_SNPRINTF snprintf
706 #define SPRINTF sprintf
707 #define VSSCANF(s, f, a) vsscanf(s, f, a)
708 #define SSCANF sscanf
709 #define VFSCANF(s, f, a) vfscanf(s, f, a)
710 #define VSCANF(f, a) vscanf(f, a)
711 #define SCANF scanf
712 #define FSCANF fscanf
713 #define WAITPID(p, s, o) waitpid(p, s, o)
714 #define ACCEPT(s, a, l) accept(s, a, l)
715 #define BIND(s, n, l) bind(s, n, l)
716 #define CONNECT(s, n, l) connect(s, n, l)
717 #define GETPEERNAME(s, n, l) getpeername(s, n, l)
718 #define GETSOCKNAME(s, n, l) getsockname(s, n, l)
719 #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p)
720 #define LISTEN(s, b) listen(s, b)
721 #define RECV(s, b, l, f) recv(s, b, l, f)
722 #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o)
723 #define SELECT(n, r, w, e, t) select(n, r, w, e, t)
724 #define SEND(s, b, l, f) send(s, b, l, f)
725 #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n)
726 #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n)
727 #define SHUTDOWN(s, h) shutdown(s, h)
728 #define SOCKET(a, t, p) socket(a, t, p)
729 #define SOCKETPAIR(a, t, p, v) socketpair(a, t, p, v)
730 #define GETHOSTBYADDR(a, l, t) gethostbyaddr(a, l, t)
731 #define GETHOSTBYNAME(n) gethostbyname(n)
732 #define GETTIMEOFDAY(t, n) gettimeofday(t, n)
733 #define INSQUE(e, p) insque(e, p)
734 #define REMQUE(e) remque(e)
735 #define HSEARCH(i, a) hsearch(i, a)
736 #define HCREATE(n) hcreate(n)
737 #define HDESTROY() hdestroy()
738 #define HSEARCH_R(i, a, r, h) hsearch_r(i, a, r, h)
739 #define HCREATE_R(n, h) hcreate_r(n, h)
740 #define HDESTROY_R(h) hdestroy_r(h)
741 #define TSEARCH(k, r, c) tsearch(k, r, c)
742 #define TFIND(k, r, c) tfind(k, r, c)
743 #define TDELETE(k, r, c) tdelete(k, r, c)
744 #define TWALK(r, a) twalk(r, a)
745 #define TDESTROY(r, f) tdestroy(r, f)
746 #define LFIND(k, b, n, s, c) lfind(k, b, n, s, c)
747 #define LSEARCH(k, b, n, s, c) lsearch(k, b, n, s, c)
748 #define STRUCT_STAT64 struct stat64
749#else
750 #define DIR_SEPARATOR '\\'
751 #define DIR_SEPARATOR_STR "\\"
752 #define PATH_SEPARATOR ';'
753 #define PATH_SEPARATOR_STR ";"
754 #define NEWLINE "\r\n"
755
756#ifdef ENABLE_NLS
757 #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n)
758#endif
759 #define CREAT(p, m) _win_creat(p, m)
760 #define PLIBC_CTIME(c) _win_ctime(c)
761 #define CTIME_R(c, b) _win_ctime_r(c, b)
762 #define FOPEN(f, m) _win_fopen(f, m)
763 #define FCLOSE(f) _win_fclose(f)
764 #define FTRUNCATE(f, l) _win_ftruncate(f, l)
765 #define TRUNCATE(f, l) _win_truncate(f, l)
766 #define OPENDIR(d) _win_opendir(d)
767 #define CLOSEDIR(d) _win_closedir(d)
768 #define READDIR(d) _win_readdir(d)
769 #define OPEN _win_open
770 #define CHDIR(d) _win_chdir(d)
771 #define CLOSE(f) _win_close(f)
772 #define PLIBC_KILL(p, s) _win_kill(p, s)
773 #define LSEEK(f, o, w) lseek(f, o, w)
774 #define FSTAT(h, b) _win_fstat(h, b)
775 #define RMDIR(f) _win_rmdir(f)
776 #define ACCESS(p, m) _win_access(p, m)
777 #define CHMOD(f, p) _win_chmod(f, p)
778 #define PIPE(h) _win_pipe(h)
779 #define RANDOM() _win_random()
780 #define SRANDOM(s) _win_srandom(s)
781 #define REMOVE(p) _win_remove(p)
782 #define RENAME(o, n) _win_rename(o, n)
783 #define STAT(p, b) _win_stat(p, b)
784 #define STAT64(p, b) _win_stati64(p, b)
785 #define SYSCONF(n) _win_sysconf(n)
786 #define UNLINK(f) _win_unlink(f)
787 #define WRITE(f, b, n) _win_write(f, b, n)
788 #define READ(f, b, n) _win_read(f, b, n)
789 #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f)
790 #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
791 #define SYMLINK(a, b) _win_symlink(a, b)
792 #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
793 #define MKFIFO(p, m) _win_mkfifo(p, m)
794 #define MSYNC(s, l, f) _win_msync(s, l, f)
795 #define MUNMAP(s, l) _win_munmap(s, l)
796 #define STRERROR(i) _win_strerror(i)
797 #define READLINK(p, b, s) _win_readlink(p, b, s)
798 #define LSTAT(p, b) _win_lstat(p, b)
799 #define LSTAT64(p, b) _win_lstati64(p, b)
800 #define PRINTF printf
801 #define FPRINTF fprintf
802 #define VPRINTF(f, a) vprintf(f, a)
803 #define VFPRINTF(s, f, a) vfprintf(s, f, a)
804 #define VSPRINTF(d, f, a) vsprintf(d, f, a)
805 #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a)
806 #define _REAL_SNPRINTF snprintf
807 #define SPRINTF sprintf
808 #define VSSCANF(s, f, a) vsscanf(s, f, a)
809 #define SSCANF sscanf
810 #define VFSCANF(s, f, a) vfscanf(s, f, a)
811 #define VSCANF(f, a) vscanf(f, a)
812 #define SCANF scanf
813 #define FSCANF fscanf
814 #define WAITPID(p, s, o) _win_waitpid(p, s, o)
815 #define ACCEPT(s, a, l) _win_accept(s, a, l)
816 #define BIND(s, n, l) _win_bind(s, n, l)
817 #define CONNECT(s, n, l) _win_connect(s, n, l)
818 #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l)
819 #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l)
820 #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p)
821 #define LISTEN(s, b) _win_listen(s, b)
822 #define RECV(s, b, l, f) _win_recv(s, b, l, f)
823 #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o)
824 #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t)
825 #define SEND(s, b, l, f) _win_send(s, b, l, f)
826 #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n)
827 #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n)
828 #define SHUTDOWN(s, h) _win_shutdown(s, h)
829 #define SOCKET(a, t, p) _win_socket(a, t, p)
830 #define SOCKETPAIR(a, t, p, v) _win_socketpair(a, t, p, v)
831 #define GETHOSTBYADDR(a, l, t) _win_gethostbyaddr(a, l, t)
832 #define GETHOSTBYNAME(n) _win_gethostbyname(n)
833 #define GETTIMEOFDAY(t, n) gettimeofday(t, n)
834 #define INSQUE(e, p) _win_insque(e, p)
835 #define REMQUE(e) _win_remque(e)
836 #define HSEARCH(i, a) _win_hsearch(i, a)
837 #define HCREATE(n) _win_hcreate(n)
838 #define HDESTROY() _win_hdestroy()
839 #define HSEARCH_R(i, a, r, h) _win_hsearch_r(i, a, r, h)
840 #define HCREATE_R(n, h) _win_hcreate_r(n, h)
841 #define HDESTROY_R(h) _win_hdestroy_r(h)
842 #define TSEARCH(k, r, c) _win_tsearch(k, r, c)
843 #define TFIND(k, r, c) _win_tfind(k, r, c)
844 #define TDELETE(k, r, c) _win_tdelete(k, r, c)
845 #define TWALK(r, a) _win_twalk(r, a)
846 #define TDESTROY(r, f) _win_tdestroy(r, f)
847 #define LFIND(k, b, n, s, c) _win_lfind(k, b, n, s, c)
848 #define LSEARCH(k, b, n, s, c) _win_lsearch(k, b, n, s, c)
849 #define STRUCT_STAT64 struct _stati64
850#endif
851
852/* search.h */
853
854/* Prototype structure for a linked-list data structure.
855 This is the type used by the `insque' and `remque' functions. */
856
857struct PLIBC_SEARCH_QELEM
858 {
859 struct qelem *q_forw;
860 struct qelem *q_back;
861 char q_data[1];
862 };
863
864
865/* Insert ELEM into a doubly-linked list, after PREV. */
866void _win_insque (void *__elem, void *__prev);
867
868/* Unlink ELEM from the doubly-linked list that it is in. */
869void _win_remque (void *__elem);
870
871
872/* For use with hsearch(3). */
873typedef int (*PLIBC_SEARCH__compar_fn_t) (__const void *, __const void *);
874
875typedef PLIBC_SEARCH__compar_fn_t _win_comparison_fn_t;
876
877/* Action which shall be performed in the call the hsearch. */
878typedef enum
879 {
880 PLIBC_SEARCH_FIND,
881 PLIBC_SEARCH_ENTER
882 }
883PLIBC_SEARCH_ACTION;
884
885typedef struct PLIBC_SEARCH_entry
886 {
887 char *key;
888 void *data;
889 }
890PLIBC_SEARCH_ENTRY;
891
892/* The reentrant version has no static variables to maintain the state.
893 Instead the interface of all functions is extended to take an argument
894 which describes the current status. */
895typedef struct _PLIBC_SEARCH_ENTRY
896{
897 unsigned int used;
898 PLIBC_SEARCH_ENTRY entry;
899}
900_PLIBC_SEARCH_ENTRY;
901
902
903/* Family of hash table handling functions. The functions also
904 have reentrant counterparts ending with _r. The non-reentrant
905 functions all work on a signle internal hashing table. */
906
907/* Search for entry matching ITEM.key in internal hash table. If
908 ACTION is `FIND' return found entry or signal error by returning
909 NULL. If ACTION is `ENTER' replace existing data (if any) with
910 ITEM.data. */
911PLIBC_SEARCH_ENTRY *_win_hsearch (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action);
912
913/* Create a new hashing table which will at most contain NEL elements. */
914int _win_hcreate (size_t __nel);
915
916/* Destroy current internal hashing table. */
917void _win_hdestroy (void);
918
919/* Data type for reentrant functions. */
920struct PLIBC_SEARCH_hsearch_data
921 {
922 struct _PLIBC_SEARCH_ENTRY *table;
923 unsigned int size;
924 unsigned int filled;
925 };
926
927/* Reentrant versions which can handle multiple hashing tables at the
928 same time. */
929int _win_hsearch_r (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action, PLIBC_SEARCH_ENTRY **__retval,
930 struct PLIBC_SEARCH_hsearch_data *__htab);
931int _win_hcreate_r (size_t __nel, struct PLIBC_SEARCH_hsearch_data *__htab);
932void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab);
933
934
935/* The tsearch routines are very interesting. They make many
936 assumptions about the compiler. It assumes that the first field
937 in node must be the "key" field, which points to the datum.
938 Everything depends on that. */
939/* For tsearch */
940typedef enum
941{
942 PLIBC_SEARCH_preorder,
943 PLIBC_SEARCH_postorder,
944 PLIBC_SEARCH_endorder,
945 PLIBC_SEARCH_leaf
946}
947PLIBC_SEARCH_VISIT;
948
949/* Search for an entry matching the given KEY in the tree pointed to
950 by *ROOTP and insert a new element if not found. */
951void *_win_tsearch (__const void *__key, void **__rootp,
952 PLIBC_SEARCH__compar_fn_t __compar);
953
954/* Search for an entry matching the given KEY in the tree pointed to
955 by *ROOTP. If no matching entry is available return NULL. */
956void *_win_tfind (__const void *__key, void *__const *__rootp,
957 PLIBC_SEARCH__compar_fn_t __compar);
958
959/* Remove the element matching KEY from the tree pointed to by *ROOTP. */
960void *_win_tdelete (__const void *__restrict __key,
961 void **__restrict __rootp,
962 PLIBC_SEARCH__compar_fn_t __compar);
963
964typedef void (*PLIBC_SEARCH__action_fn_t) (__const void *__nodep, PLIBC_SEARCH_VISIT __value,
965 int __level);
966
967/* Walk through the whole tree and call the ACTION callback for every node
968 or leaf. */
969void _win_twalk (__const void *__root, PLIBC_SEARCH__action_fn_t __action);
970
971/* Callback type for function to free a tree node. If the keys are atomic
972 data this function should do nothing. */
973typedef void (*PLIBC_SEARCH__free_fn_t) (void *__nodep);
974
975/* Destroy the whole tree, call FREEFCT for each node or leaf. */
976void _win_tdestroy (void *__root, PLIBC_SEARCH__free_fn_t __freefct);
977
978
979/* Perform linear search for KEY by comparing by COMPAR in an array
980 [BASE,BASE+NMEMB*SIZE). */
981void *_win_lfind (__const void *__key, __const void *__base,
982 size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compar);
983
984/* Perform linear search for KEY by comparing by COMPAR function in
985 array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */
986void *_win_lsearch (__const void *__key, void *__base,
987 size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compar);
988
989
990#ifdef __cplusplus
991}
992#endif
993
994
995#endif //_PLIBC_H_
996
997/* end of plibc.h */