/* * Functions Windows doesn't have... but should * Copyright(C) 2001, Linux Support Services, Inc. * * Distributed under GNU LGPL. * * These are NOT fully compliant with BSD 4.3 and are not * threadsafe. * */ #ifndef _winpoop_h #define _winpoop_h #if defined(_MSC_VER) #define INLINE __inline #define inline __inline #if _MSC_VER < 1900 #define snprintf _snprintf #endif // should try without these #pragma warning(disable: 4996 4244 4305 4018 4804) #if defined(_WIN64) typedef __int64 ssize_t; #elif defined(_WIN32) typedef __int32 ssize_t; #endif #else #define INLINE inline #endif #include // this include #include // for open, close, write, read #include void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz); static INLINE int inet_aton(char *cp, struct in_addr *inp) { int a1, a2, a3, a4; unsigned int saddr; if (sscanf(cp, "%d.%d.%d.%d", &a1, &a2, &a3, &a4) != 4) return 0; a1 &= 0xff; a2 &= 0xff; a3 &= 0xff; a4 &= 0xff; saddr = (a1 << 24) | (a2 << 16) | (a3 << 8) | a4; inp->s_addr = htonl(saddr); return 1; } #endif