2 * Copyright (C) 2010 Brian Aker, Trond Norbye
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
8 * Summary: "Implementation" of the function we don't have on windows
9 * to avoid a bunch of ifdefs in the rest of the code
12 #ifndef WIN32_WRAPPERS_H
13 #define WIN32_WRAPPERS_H 1
18 * One of the Windows headers define interface as a macro, but that
19 * is causing problems with the member named "interface" in some of the
29 * WinSock use a separate range for error codes. Let's just map to the
32 #define EADDRINUSE WSAEADDRINUSE
33 #define EWOULDBLOCK WSAEWOULDBLOCK
34 #define EINPROGRESS WSAEINPROGRESS
35 #define EALREADY WSAEALREADY
36 #define EISCONN WSAEISCONN
37 #define ENOTCONN WSAENOTCONN
38 #define ENOBUFS WSAENOBUFS
39 #define SHUT_RDWR SD_BOTH
41 /* EAI_SYSTEM isn't defined anywhere... just set it to... 11? */
44 /* Best effort mapping of functions to alternative functions */
45 #define index(a,b) strchr(a,b)
46 #define rindex(a,b) strrchr(a,b)
47 #define random() rand()
48 #define srandom(a) while (false) {}
49 #define kill(a, b) while (false) {}
51 #define waitpid(a,b,c) (-1)
52 #define fnmatch(a,b,c) (-1)
53 #define sleep(a) Sleep(a*1000)
55 #endif /* WIN32_WRAPPERS_H */