-#define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n)
-#endif /* */
-#define CREAT(p, m) _win_creat(p, m)
-#define FOPEN(f, m) _win_fopen(f, m)
-#define FTRUNCATE(f, l) _win_ftruncate(f, l)
-#define OPENDIR(d) _win_opendir(d)
-#define OPEN _win_open
-#define CHDIR(d) _win_chdir(d)
-#define CLOSE(f) _win_close(f)
-#define PLIBC_KILL(p, s) _win_kill(p, s)
-#define LSEEK(f, o, w) _win_lseek(f, o, w)
-#define FSTAT(h, b) _win_fstat(h, b)
-#define RMDIR(f) _win_rmdir(f)
-#define ACCESS(p, m) _win_access(p, m)
-#define CHMOD(f, p) _win_chmod(f, p)
-#define PIPE(h) _win_pipe(h)
-#define RANDOM() _win_random()
-#define REMOVE(p) _win_remove(p)
-#define RENAME(o, n) _win_rename(o, n)
-#define STAT(p, b) _win_stat(p, b)
-#define STAT64(p, b) _win_stat64(p, b)
-#define UNLINK(f) _win_unlink(f)
-#define WRITE(f, b, n) _win_write(f, b, n)
-#define READ(f, b, n) _win_read(f, b, n)
-#define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f)
-#define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
-#define SYMLINK(a, b) _win_symlink(a, b)
-#define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
-#define MUNMAP(s, l) _win_munmap(s, l)
-#define STRERROR(i) _win_strerror(i)
-#define READLINK(p, b, s) _win_readlink(p, b, s)
-#define LSTAT(p, b) _win_lstat(p, b)
-#define LSTAT64(p, b) _win_lstat64(p, b)
-#define PRINTF(f, ...) _win_printf(f , __VA_ARGS__)
-#define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__)
-#define VPRINTF(f, a) _win_vprintf(f, a)
-#define VFPRINTF(s, f, a) _win_vfprintf(s, f, a)
-#define VSPRINTF(d, f, a) _win_vsprintf(d, f, a)
-#define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a)
-#define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__)
-#define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__)
-#define VSSCANF(s, f, a) _win_vsscanf(s, f, a)
-#define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__)
-#define VFSCANF(s, f, a) _win_vfscanf(s, f, a)
-#define VSCANF(f, a) _win_vscanf(f, a)
-#define SCANF(f, ...) _win_scanf(f, __VA_ARGS__)
-#define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__)
-#define WAITPID(p, s, o) _win_waitpid(p, s, o)
-#define ACCEPT(s, a, l) _win_accept(s, a, l)
-#define BIND(s, n, l) _win_bind(s, n, l)
-#define CONNECT(s, n, l) _win_connect(s, n, l)
-#define GETPEERNAME(s, n, l) _win_getpeername(s, n, l)
-#define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l)
-#define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p)
-#define LISTEN(s, b) _win_listen(s, b)
-#define RECV(s, b, l, f) _win_recv(s, b, l, f)
-#define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o)
-#define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t)
-#define SEND(s, b, l, f) _win_send(s, b, l, f)
-#define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n)
-#define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n)
-#define SHUTDOWN(s, h) _win_shutdown(s, h)
-#define SOCKET(a, t, p) _win_socket(a, t, p)
-#define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t)
-#define GETHOSTBYNAME(n) _win_gethostbyname(n)
-#endif /* */
+ #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n)
+#endif
+ #define CREAT(p, m) _win_creat(p, m)
+ #define PLIBC_CTIME(c) _win_ctime(c)
+ #define CTIME_R(c, b) _win_ctime_r(c, b)
+ #define FOPEN(f, m) _win_fopen(f, m)
+ #define FCLOSE(f) _win_fclose(f)
+ #define FTRUNCATE(f, l) _win_ftruncate(f, l)
+ #define OPENDIR(d) _win_opendir(d)
+ #define CLOSEDIR(d) _win_closedir(d)
+ #define READDIR(d) _win_readdir(d)
+ #define OPEN _win_open
+ #define CHDIR(d) _win_chdir(d)
+ #define CLOSE(f) _win_close(f)
+ #define PLIBC_KILL(p, s) _win_kill(p, s)
+ #define LSEEK(f, o, w) _win_lseek(f, o, w)
+ #define FSTAT(h, b) _win_fstat(h, b)
+ #define RMDIR(f) _win_rmdir(f)
+ #define ACCESS(p, m) _win_access(p, m)
+ #define CHMOD(f, p) _win_chmod(f, p)
+ #define PIPE(h) _win_pipe(h)
+ #define RANDOM() _win_random()
+ #define SRANDOM(s) _win_srandom(s)
+ #define REMOVE(p) _win_remove(p)
+ #define RENAME(o, n) _win_rename(o, n)
+ #define STAT(p, b) _win_stat(p, b)
+ #define STAT64(p, b) _win_stat64(p, b)
+ #define SYSCONF(n) _win_sysconf(n)
+ #define UNLINK(f) _win_unlink(f)
+ #define WRITE(f, b, n) _win_write(f, b, n)
+ #define READ(f, b, n) _win_read(f, b, n)
+ #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f)
+ #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
+ #define SYMLINK(a, b) _win_symlink(a, b)
+ #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
+ #define MKFIFO(p, m) _win_mkfifo(p, m)
+ #define MSYNC(s, l, f) _win_msync(s, l, f)
+ #define MUNMAP(s, l) _win_munmap(s, l)
+ #define STRERROR(i) _win_strerror(i)
+ #define READLINK(p, b, s) _win_readlink(p, b, s)
+ #define LSTAT(p, b) _win_lstat(p, b)
+ #define LSTAT64(p, b) _win_lstat64(p, b)
+ #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__)
+ #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__)
+ #define VPRINTF(f, a) _win_vprintf(f, a)
+ #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a)
+ #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a)
+ #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a)
+ #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__)
+ #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__)
+ #define VSSCANF(s, f, a) _win_vsscanf(s, f, a)
+ #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__)
+ #define VFSCANF(s, f, a) _win_vfscanf(s, f, a)
+ #define VSCANF(f, a) _win_vscanf(f, a)
+ #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__)
+ #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__)
+ #define WAITPID(p, s, o) _win_waitpid(p, s, o)
+ #define ACCEPT(s, a, l) _win_accept(s, a, l)
+ #define BIND(s, n, l) _win_bind(s, n, l)
+ #define CONNECT(s, n, l) _win_connect(s, n, l)
+ #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l)
+ #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l)
+ #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p)
+ #define LISTEN(s, b) _win_listen(s, b)
+ #define RECV(s, b, l, f) _win_recv(s, b, l, f)
+ #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o)
+ #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t)
+ #define SEND(s, b, l, f) _win_send(s, b, l, f)
+ #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n)
+ #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n)
+ #define SHUTDOWN(s, h) _win_shutdown(s, h)
+ #define SOCKET(a, t, p) _win_socket(a, t, p)
+ #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t)
+ #define GETHOSTBYNAME(n) _win_gethostbyname(n)
+ #define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n)
+ #define INSQUE(e, p) _win_insque(e, p)
+ #define REMQUE(e) _win_remque(e)
+ #define HSEARCH(i, a) _win_hsearch(i, a)
+ #define HCREATE(n) _win_hcreate(n)
+ #define HDESTROY() _win_hdestroy()
+ #define HSEARCH_R(i, a, r, h) _win_hsearch_r(i, a, r, h)
+ #define HCREATE_R(n, h) _win_hcreate_r(n, h)
+ #define HDESTROY_R(h) _win_hdestroy_r(h)
+ #define TSEARCH(k, r, c) _win_tsearch(k, r, c)
+ #define TFIND(k, r, c) _win_tfind(k, r, c)
+ #define TDELETE(k, r, c) _win_tdelete(k, r, c)
+ #define TWALK(r, a) _win_twalk(r, a)
+ #define TDESTROY(r, f) _win_tdestroy(r, f)
+ #define LFIND(k, b, n, s, c) _win_lfind(k, b, n, s, c)
+ #define LSEARCH(k, b, n, s, c) _win_lsearch(k, b, n, s, c)
+#endif
+
+/* search.h */
+
+/* Prototype structure for a linked-list data structure.
+ This is the type used by the `insque' and `remque' functions. */
+
+struct PLIBC_SEARCH_QELEM
+ {
+ struct qelem *q_forw;
+ struct qelem *q_back;
+ char q_data[1];
+ };
+
+
+/* Insert ELEM into a doubly-linked list, after PREV. */
+void _win_insque (void *__elem, void *__prev);
+
+/* Unlink ELEM from the doubly-linked list that it is in. */
+void _win_remque (void *__elem);
+
+
+/* For use with hsearch(3). */
+typedef int (*PLIBC_SEARCH__compar_fn_t) (__const void *, __const void *);
+
+typedef PLIBC_SEARCH__compar_fn_t _win_comparison_fn_t;
+
+/* Action which shall be performed in the call the hsearch. */
+typedef enum
+ {
+ PLIBC_SEARCH_FIND,
+ PLIBC_SEARCH_ENTER
+ }
+PLIBC_SEARCH_ACTION;
+
+typedef struct PLIBC_SEARCH_entry
+ {
+ char *key;
+ void *data;
+ }
+PLIBC_SEARCH_ENTRY;
+
+/* The reentrant version has no static variables to maintain the state.
+ Instead the interface of all functions is extended to take an argument
+ which describes the current status. */
+typedef struct _PLIBC_SEARCH_ENTRY
+{
+ unsigned int used;
+ PLIBC_SEARCH_ENTRY entry;
+}
+_PLIBC_SEARCH_ENTRY;
+
+
+/* Family of hash table handling functions. The functions also
+ have reentrant counterparts ending with _r. The non-reentrant
+ functions all work on a signle internal hashing table. */
+
+/* Search for entry matching ITEM.key in internal hash table. If
+ ACTION is `FIND' return found entry or signal error by returning
+ NULL. If ACTION is `ENTER' replace existing data (if any) with
+ ITEM.data. */
+PLIBC_SEARCH_ENTRY *_win_hsearch (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action);
+
+/* Create a new hashing table which will at most contain NEL elements. */
+int _win_hcreate (size_t __nel);
+
+/* Destroy current internal hashing table. */
+void _win_hdestroy (void);
+
+/* Data type for reentrant functions. */
+struct PLIBC_SEARCH_hsearch_data
+ {
+ struct _PLIBC_SEARCH_ENTRY *table;
+ unsigned int size;
+ unsigned int filled;
+ };
+
+/* Reentrant versions which can handle multiple hashing tables at the
+ same time. */
+int _win_hsearch_r (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action, PLIBC_SEARCH_ENTRY **__retval,
+ struct PLIBC_SEARCH_hsearch_data *__htab);
+int _win_hcreate_r (size_t __nel, struct PLIBC_SEARCH_hsearch_data *__htab);
+void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab);
+
+
+/* The tsearch routines are very interesting. They make many
+ assumptions about the compiler. It assumes that the first field
+ in node must be the "key" field, which points to the datum.
+ Everything depends on that. */
+/* For tsearch */
+typedef enum
+{
+ PLIBC_SEARCH_preorder,
+ PLIBC_SEARCH_postorder,
+ PLIBC_SEARCH_endorder,
+ PLIBC_SEARCH_leaf
+}
+PLIBC_SEARCH_VISIT;
+
+/* Search for an entry matching the given KEY in the tree pointed to
+ by *ROOTP and insert a new element if not found. */
+void *_win_tsearch (__const void *__key, void **__rootp,
+ PLIBC_SEARCH__compar_fn_t __compar);
+
+/* Search for an entry matching the given KEY in the tree pointed to
+ by *ROOTP. If no matching entry is available return NULL. */
+void *_win_tfind (__const void *__key, void *__const *__rootp,
+ PLIBC_SEARCH__compar_fn_t __compar);
+
+/* Remove the element matching KEY from the tree pointed to by *ROOTP. */
+void *_win_tdelete (__const void *__restrict __key,
+ void **__restrict __rootp,
+ PLIBC_SEARCH__compar_fn_t __compar);
+
+typedef void (*PLIBC_SEARCH__action_fn_t) (__const void *__nodep, PLIBC_SEARCH_VISIT __value,
+ int __level);
+
+/* Walk through the whole tree and call the ACTION callback for every node
+ or leaf. */
+void _win_twalk (__const void *__root, PLIBC_SEARCH__action_fn_t __action);
+
+/* Callback type for function to free a tree node. If the keys are atomic
+ data this function should do nothing. */
+typedef void (*PLIBC_SEARCH__free_fn_t) (void *__nodep);
+
+/* Destroy the whole tree, call FREEFCT for each node or leaf. */
+void _win_tdestroy (void *__root, PLIBC_SEARCH__free_fn_t __freefct);
+
+
+/* Perform linear search for KEY by comparing by COMPAR in an array
+ [BASE,BASE+NMEMB*SIZE). */
+void *_win_lfind (__const void *__key, __const void *__base,
+ size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compar);
+
+/* Perform linear search for KEY by comparing by COMPAR function in
+ array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */
+void *_win_lsearch (__const void *__key, void *__base,
+ size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compar);
+