1 2 /* 3 * Time-stamp: "2006-10-14 14:55:09 bkorb" 4 * by: bkorb 5 * Last Committed: $Date: 2007/04/28 22:19:23 $ 6 */ 7 #ifndef WINDOWS_CONFIG_HACKERY 8 #define WINDOWS_CONFIG_HACKERY 1 9 10 /* 11 * The definitions below have been stolen from NTP's config.h for Windows. 12 * However, they may be kept here in order to keep libopts independent from 13 * the NTP project. 14 */ 15 #ifndef __windows__ 16 # define __windows__ 4 17 #endif 18 19 /* 20 * Miscellaneous functions that Microsoft maps 21 * to other names 22 * 23 * #define inline __inline 24 * #define vsnprintf _vsnprintf 25 */ 26 #define snprintf _snprintf 27 /* 28 * #define stricmp _stricmp 29 * #define strcasecmp _stricmp 30 * #define isascii __isascii 31 * #define finite _finite 32 * #define random rand 33 * #define srandom srand 34 */ 35 36 #define SIZEOF_INT 4 37 #define SIZEOF_CHARP 4 38 #define SIZEOF_LONG 4 39 #define SIZEOF_SHORT 2 40 41 typedef unsigned long uintptr_t; 42 43 /* 44 * # define HAVE_NET_IF_H 45 * # define QSORT_USES_VOID_P 46 * # define HAVE_SETVBUF 47 * # define HAVE_VSPRINTF 48 * # define HAVE_SNPRINTF 49 * # define HAVE_VSNPRINTF 50 * # define HAVE_PROTOTYPES /* from ntpq.mak * / 51 * # define HAVE_MEMMOVE 52 * # define HAVE_TERMIOS_H 53 * # define HAVE_ERRNO_H 54 * # define HAVE_STDARG_H 55 * # define HAVE_NO_NICE 56 * # define HAVE_MKTIME 57 * # define TIME_WITH_SYS_TIME 58 * # define HAVE_IO_COMPLETION_PORT 59 * # define ISC_PLATFORM_NEEDNTOP 60 * # define ISC_PLATFORM_NEEDPTON 61 * # define NEED_S_CHAR_TYPEDEF 62 * # define USE_PROTOTYPES /* for ntp_types.h * / 63 * 64 * #define ULONG_CONST(a) a ## UL 65 */ 66 67 #define HAVE_LIMITS_H 1 68 #define HAVE_STRDUP 1 69 #define HAVE_STRCHR 1 70 #define HAVE_FCNTL_H 1 71 72 /* 73 * VS.NET's version of wspiapi.h has a bug in it 74 * where it assigns a value to a variable inside 75 * an if statement. It should be comparing them. 76 * We prevent inclusion since we are not using this 77 * code so we don't have to see the warning messages 78 */ 79 #ifndef _WSPIAPI_H_ 80 #define _WSPIAPI_H_ 81 #endif 82 83 /* Prevent inclusion of winsock.h in windows.h */ 84 #ifndef _WINSOCKAPI_ 85 #define _WINSOCKAPI_ 86 #endif 87 88 #ifndef __RPCASYNC_H__ 89 #define __RPCASYNC_H__ 90 #endif 91 92 /* Include Windows headers */ 93 #include <windows.h> 94 #include <winsock2.h> 95 #include <limits.h> 96 97 /* 98 * Compatibility declarations for Windows, assuming SYS_WINNT 99 * has been defined. 100 */ 101 #define strdup _strdup 102 #define stat _stat /* struct stat from <sys/stat.h> */ 103 #define unlink _unlink 104 #define fchmod( _x, _y ); 105 #define ssize_t SSIZE_T 106 107 #include <io.h> 108 #define open _open 109 #define close _close 110 #define read _read 111 #define write _write 112 #define lseek _lseek 113 #define pipe _pipe 114 #define dup2 _dup2 115 116 #define O_RDWR _O_RDWR 117 #define O_RDONLY _O_RDONLY 118 #define O_EXCL _O_EXCL 119 120 #ifndef S_ISREG 121 # define S_IFREG _S_IFREG 122 # define S_ISREG(mode) (((mode) & S_IFREG) == S_IFREG) 123 #endif 124 125 #ifndef S_ISDIR 126 # define S_IFDIR _S_IFDIR 127 # define S_ISDIR(mode) (((mode) & S_IFDIR) == S_IFDIR) 128 #endif 129 130 #endif /* WINDOWS_CONFIG_HACKERY */ 131