windows-config.h 2.9 KB

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