1 2/* 3 * Time-stamp: "2009-07-22 18:53:59 bkorb" 4 * by: bkorb 5 * 6 * This file is part of AutoGen. 7 * 8 * AutoGen copyright (c) 1992-2009 by Bruce Korb - all rights reserved 9 * 10 * AutoGen is free software: you can redistribute it and/or modify it 11 * under the terms of the GNU General Public License as published by the 12 * Free Software Foundation, either version 3 of the License, or 13 * (at your option) any later version. 14 * 15 * AutoGen is distributed in the hope that it will be useful, but 16 * WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 * See the GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License along 21 * with this program. If not, see <http://www.gnu.org/licenses/>. 22 */ 23#ifndef WINDOWS_CONFIG_HACKERY 24#define WINDOWS_CONFIG_HACKERY 1 25 26/* 27 * The definitions below have been stolen from NTP's config.h for Windows. 28 * However, they may be kept here in order to keep libopts independent from 29 * the NTP project. 30 */ 31#ifndef __windows__ 32# define __windows__ 4 33#endif 34 35/* 36 * Miscellaneous functions that Microsoft maps 37 * to other names 38 * 39 * #define inline __inline 40 * #define vsnprintf _vsnprintf 41 */ 42#define snprintf _snprintf 43/* 44 * #define stricmp _stricmp 45 * #define strcasecmp _stricmp 46 * #define isascii __isascii 47 * #define finite _finite 48 * #define random rand 49 * #define srandom srand 50 */ 51 52#define SIZEOF_INT 4 53#define SIZEOF_CHARP 4 54#define SIZEOF_LONG 4 55#define SIZEOF_SHORT 2 56 57typedef unsigned long uintptr_t; 58 59/* 60 * # define HAVE_NET_IF_H 61 * # define QSORT_USES_VOID_P 62 * # define HAVE_SETVBUF 63 * # define HAVE_VSPRINTF 64 * # define HAVE_SNPRINTF 65 * # define HAVE_VSNPRINTF 66 * # define HAVE_PROTOTYPES /* from ntpq.mak * / 67 * # define HAVE_MEMMOVE 68 * # define HAVE_TERMIOS_H 69 * # define HAVE_ERRNO_H 70 * # define HAVE_STDARG_H 71 * # define HAVE_NO_NICE 72 * # define HAVE_MKTIME 73 * # define TIME_WITH_SYS_TIME 74 * # define HAVE_IO_COMPLETION_PORT 75 * # define ISC_PLATFORM_NEEDNTOP 76 * # define ISC_PLATFORM_NEEDPTON 77 * # define NEED_S_CHAR_TYPEDEF 78 * # define USE_PROTOTYPES /* for ntp_types.h * / 79 * 80 * #define ULONG_CONST(a) a ## UL 81 */ 82 83#define HAVE_LIMITS_H 1 84#define HAVE_STRDUP 1 85#define HAVE_STRCHR 1 86#define HAVE_FCNTL_H 1 87 88/* 89 * VS.NET's version of wspiapi.h has a bug in it 90 * where it assigns a value to a variable inside 91 * an if statement. It should be comparing them. 92 * We prevent inclusion since we are not using this 93 * code so we don't have to see the warning messages 94 */ 95#ifndef _WSPIAPI_H_ 96#define _WSPIAPI_H_ 97#endif 98 99/* Prevent inclusion of winsock.h in windows.h */ 100#ifndef _WINSOCKAPI_ 101#define _WINSOCKAPI_ 102#endif 103 104#ifndef __RPCASYNC_H__ 105#define __RPCASYNC_H__ 106#endif 107 108/* Include Windows headers */ 109#include <windows.h> 110#include <winsock2.h> 111#include <limits.h> 112 113/* 114 * Compatibility declarations for Windows, assuming SYS_WINNT 115 * has been defined. 116 */ 117#define strdup _strdup 118#define stat _stat /* struct stat from <sys/stat.h> */ 119#define unlink _unlink 120#define fchmod( _x, _y ); 121#define ssize_t SSIZE_T 122 123#include <io.h> 124#define open _open 125#define close _close 126#define read _read 127#define write _write 128#define lseek _lseek 129#define pipe _pipe 130#define dup2 _dup2 131 132#define O_RDWR _O_RDWR 133#define O_RDONLY _O_RDONLY 134#define O_EXCL _O_EXCL 135 136#ifndef S_ISREG 137# define S_IFREG _S_IFREG 138# define S_ISREG(mode) (((mode) & S_IFREG) == S_IFREG) 139#endif 140 141#ifndef S_ISDIR 142# define S_IFDIR _S_IFDIR 143# define S_ISDIR(mode) (((mode) & S_IFDIR) == S_IFDIR) 144#endif 145 146#endif /* WINDOWS_CONFIG_HACKERY */ 147