|
|
@ -7,6 +7,7 @@ |
|
|
|
#define _GNU_SOURCE |
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
#include <stdint.h> |
|
|
|
#include <stdarg.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include <string.h> |
|
|
@ -14,10 +15,18 @@ |
|
|
|
#include <unistd.h> |
|
|
|
#include <pthread.h> |
|
|
|
#include <getopt.h> |
|
|
|
#ifdef _WIN32 |
|
|
|
#undef _WIN32_WINNT |
|
|
|
#define _WIN32_WINNT 0x600 |
|
|
|
#include <winsock2.h> |
|
|
|
#include <ws2ipdef.h> |
|
|
|
#include <ws2tcpip.h> |
|
|
|
#else |
|
|
|
#include <sys/socket.h> |
|
|
|
#include <arpa/inet.h> |
|
|
|
#include <netinet/in.h> |
|
|
|
#include <netdb.h> |
|
|
|
#endif |
|
|
|
#include <time.h> |
|
|
|
|
|
|
|
#define RESOLVER_EAGAIN_ATTEMPTS 2 |
|
|
@ -56,8 +65,10 @@ static const char* eai_str(int r) |
|
|
|
return "EAI_SERVICE"; |
|
|
|
case EAI_SOCKTYPE: |
|
|
|
return "EAI_SOCKTYPE"; |
|
|
|
#ifdef EAI_SYSTEM |
|
|
|
case EAI_SYSTEM: |
|
|
|
return "EAI_SYSTEM"; |
|
|
|
#endif |
|
|
|
default: |
|
|
|
return "UNKNOWN"; |
|
|
|
} |
|
|
@ -384,6 +395,15 @@ int main(int argc, char **argv) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
WSADATA wsaData; |
|
|
|
if (WSAStartup(MAKEWORD(2, 2), &wsaData)) |
|
|
|
{ |
|
|
|
fprintf(stderr,"WSAStartup failed\n"); |
|
|
|
goto ex; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
if (*fn1) |
|
|
|
{ |
|
|
|
glob.F_log_resolved = fopen(fn1,"wt"); |
|
|
|