| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
#ifndef _winpoop_h |
| 13 |
#define _winpoop_h |
| 14 |
|
| 15 |
#if defined(_MSC_VER) |
| 16 |
#define INLINE __inline |
| 17 |
#define inline __inline |
| 18 |
|
| 19 |
#if _MSC_VER < 1900 |
| 20 |
#define snprintf _snprintf |
| 21 |
#endif |
| 22 |
|
| 23 |
|
| 24 |
#pragma warning(disable: 4996 4244 4305 4018 4804) |
| 25 |
#if defined(_WIN64) |
| 26 |
typedef __int64 ssize_t; |
| 27 |
#elif defined(_WIN32) |
| 28 |
typedef __int32 ssize_t; |
| 29 |
#endif |
| 30 |
#else |
| 31 |
#define INLINE inline |
| 32 |
#endif |
| 33 |
|
| 34 |
#include <winsock2.h> |
| 35 |
#include <io.h> |
| 36 |
#include <stdio.h> |
| 37 |
|
| 38 |
void gettimeofday(struct timeval *tv, void *tz); |
| 39 |
|
| 40 |
static INLINE int inet_aton(char *cp, struct in_addr *inp) |
| 41 |
{ |
| 42 |
int a1, a2, a3, a4; |
| 43 |
unsigned int saddr; |
| 44 |
|
| 45 |
if (sscanf(cp, "%d.%d.%d.%d", &a1, &a2, &a3, &a4) != 4) |
| 46 |
return 0; |
| 47 |
a1 &= 0xff; |
| 48 |
a2 &= 0xff; |
| 49 |
a3 &= 0xff; |
| 50 |
a4 &= 0xff; |
| 51 |
saddr = (a1 << 24) | (a2 << 16) | (a3 << 8) | a4; |
| 52 |
inp->s_addr = htonl(saddr); |
| 53 |
return 1; |
| 54 |
} |
| 55 |
|
| 56 |
#endif |