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