1*eabc0478Schristos /* $NetBSD: windows-config.h,v 1.6 2024/08/18 20:47:26 christos Exp $ */ 2abb0f93cSkardel 3abb0f93cSkardel 48585484eSchristos /** 58585484eSchristos * \file windows-config.h 6abb0f93cSkardel * 78585484eSchristos * This file contains all of the routines that must be linked into 88585484eSchristos * an executable to use the generated option processing. The optional 98585484eSchristos * routines are in separately compiled modules so that they will not 108585484eSchristos * necessarily be linked in. 11abb0f93cSkardel * 128585484eSchristos * This file is part of AutoOpts, a companion to AutoGen. 138585484eSchristos * AutoOpts is free software. 14*eabc0478Schristos * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved 15abb0f93cSkardel * 168585484eSchristos * AutoOpts is available under any one of two licenses. The license 178585484eSchristos * in use must be one of these two and the choice is under the control 188585484eSchristos * of the user of the license. 19abb0f93cSkardel * 208585484eSchristos * The GNU Lesser General Public License, version 3 or later 218585484eSchristos * See the files "COPYING.lgplv3" and "COPYING.gplv3" 22abb0f93cSkardel * 238585484eSchristos * The Modified Berkeley Software Distribution License 248585484eSchristos * See the file "COPYING.mbsd" 258585484eSchristos * 268585484eSchristos * These files have the following sha256 sums: 278585484eSchristos * 288585484eSchristos * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 298585484eSchristos * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 308585484eSchristos * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd 31abb0f93cSkardel */ 328585484eSchristos 33abb0f93cSkardel #ifndef WINDOWS_CONFIG_HACKERY 34abb0f93cSkardel #define WINDOWS_CONFIG_HACKERY 1 35abb0f93cSkardel 36abb0f93cSkardel /* 37abb0f93cSkardel * The definitions below have been stolen from NTP's config.h for Windows. 38abb0f93cSkardel * However, they may be kept here in order to keep libopts independent from 39abb0f93cSkardel * the NTP project. 40abb0f93cSkardel */ 41abb0f93cSkardel #ifndef __windows__ 42abb0f93cSkardel # define __windows__ 4 43abb0f93cSkardel #endif 44abb0f93cSkardel 45abb0f93cSkardel /* 468585484eSchristos * Miscellaneous functions that Microsoft maps to other names 47abb0f93cSkardel */ 48abb0f93cSkardel #define snprintf _snprintf 49abb0f93cSkardel 50abb0f93cSkardel #define SIZEOF_INT 4 51abb0f93cSkardel #define SIZEOF_CHARP 4 52abb0f93cSkardel #define SIZEOF_LONG 4 53abb0f93cSkardel #define SIZEOF_SHORT 2 54abb0f93cSkardel 55abb0f93cSkardel #define HAVE_LIMITS_H 1 56abb0f93cSkardel #define HAVE_STRDUP 1 57abb0f93cSkardel #define HAVE_STRCHR 1 58abb0f93cSkardel #define HAVE_FCNTL_H 1 59abb0f93cSkardel 60abb0f93cSkardel /* 618585484eSchristos * VS.NET's version of wspiapi.h has a bug in it where it assigns a value 628585484eSchristos * to a variable inside an if statement. It should be comparing them. 638585484eSchristos * We prevent inclusion since we are not using this code so we don't have 648585484eSchristos * to see the warning messages 65abb0f93cSkardel */ 66abb0f93cSkardel #ifndef _WSPIAPI_H_ 67abb0f93cSkardel #define _WSPIAPI_H_ 68abb0f93cSkardel #endif 69abb0f93cSkardel 70abb0f93cSkardel /* Prevent inclusion of winsock.h in windows.h */ 71abb0f93cSkardel #ifndef _WINSOCKAPI_ 72abb0f93cSkardel #define _WINSOCKAPI_ 73abb0f93cSkardel #endif 74abb0f93cSkardel 75abb0f93cSkardel #ifndef __RPCASYNC_H__ 76abb0f93cSkardel #define __RPCASYNC_H__ 77abb0f93cSkardel #endif 78abb0f93cSkardel 79abb0f93cSkardel /* Include Windows headers */ 80abb0f93cSkardel #include <windows.h> 81abb0f93cSkardel #include <winsock2.h> 82abb0f93cSkardel #include <limits.h> 83abb0f93cSkardel 84abb0f93cSkardel /* 85abb0f93cSkardel * Compatibility declarations for Windows, assuming SYS_WINNT 86abb0f93cSkardel * has been defined. 87abb0f93cSkardel */ 88abb0f93cSkardel #define strdup _strdup 89abb0f93cSkardel #define stat _stat /* struct stat from <sys/stat.h> */ 90abb0f93cSkardel #define unlink _unlink 918585484eSchristos #define fchmod( _x, _y ) 92abb0f93cSkardel #define ssize_t SSIZE_T 93abb0f93cSkardel 94abb0f93cSkardel #include <io.h> 95abb0f93cSkardel #define open _open 96abb0f93cSkardel #define close _close 97abb0f93cSkardel #define read _read 98abb0f93cSkardel #define write _write 99abb0f93cSkardel #define lseek _lseek 100abb0f93cSkardel #define pipe _pipe 101abb0f93cSkardel #define dup2 _dup2 102abb0f93cSkardel 103abb0f93cSkardel #define O_RDWR _O_RDWR 104abb0f93cSkardel #define O_RDONLY _O_RDONLY 105abb0f93cSkardel #define O_EXCL _O_EXCL 106abb0f93cSkardel 107abb0f93cSkardel #ifndef S_ISREG 108abb0f93cSkardel # define S_IFREG _S_IFREG 109abb0f93cSkardel # define S_ISREG(mode) (((mode) & S_IFREG) == S_IFREG) 110abb0f93cSkardel #endif 111abb0f93cSkardel 112abb0f93cSkardel #ifndef S_ISDIR 113abb0f93cSkardel # define S_IFDIR _S_IFDIR 114abb0f93cSkardel # define S_ISDIR(mode) (((mode) & S_IFDIR) == S_IFDIR) 115abb0f93cSkardel #endif 116abb0f93cSkardel 1178585484eSchristos /* C99 exact size integer support. */ 1188585484eSchristos #if defined(HAVE_INTTYPES_H) 1198585484eSchristos # include <inttypes.h> 1208585484eSchristos 1218585484eSchristos #elif defined(HAVE_STDINT_H) 1228585484eSchristos # include <stdint.h> 1238585484eSchristos # define MISSING_INTTYPES_H 1 1248585484eSchristos 1258585484eSchristos #elif ! defined(ADDED_EXACT_SIZE_INTEGERS) 1268585484eSchristos # define ADDED_EXACT_SIZE_INTEGERS 1 1278585484eSchristos # define MISSING_INTTYPES_H 1 1288585484eSchristos 1298585484eSchristos typedef __int8 int8_t; 1308585484eSchristos typedef unsigned __int8 uint8_t; 1318585484eSchristos 1328585484eSchristos typedef __int16 int16_t; 1338585484eSchristos typedef unsigned __int16 uint16_t; 1348585484eSchristos 1358585484eSchristos typedef __int32 int32_t; 1368585484eSchristos typedef unsigned __int32 uint32_t; 1378585484eSchristos 1388585484eSchristos typedef __int64 int64_t; 1398585484eSchristos typedef unsigned __int64 uint64_t; 1408585484eSchristos 1418585484eSchristos typedef unsigned long uintptr_t; 1428585484eSchristos typedef long intptr_t; 1438585484eSchristos #endif 1448585484eSchristos 145abb0f93cSkardel #endif /* WINDOWS_CONFIG_HACKERY */ 1468585484eSchristos /* windows-config.h ends here */ 147