Annotation of embedaddon/ntp/sntp/libopts/compat/windows-config.h, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>