1
0

windows-config.h 3.7 KB

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