1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -05:00

Changes for Watt-32 on Windows. I've assumed Configure

sets the required HAVE_xx defines for non-DOS/Win targets.
This commit is contained in:
Gisle Vanem 2004-08-20 13:45:26 +00:00
parent cd52b9f0da
commit b17e32baa7
17 changed files with 88 additions and 48 deletions

View File

@ -27,11 +27,14 @@
#include <sys/select.h>
#endif
#ifdef WIN32
#include <winsock.h>
#include <windows.h>
#if defined(WATT32)
#include <netinet/in.h>
#include <tcp.h>
#elif defined(WIN32)
#include <winsock.h>
#include <windows.h>
#else
#include <netinet/in.h>
#include <netinet/in.h>
#endif
#define ARES_SUCCESS 0

View File

@ -16,10 +16,10 @@
#include "setup.h"
#include <stdlib.h>
#ifdef WIN32
#else
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "ares.h"
#include "ares_private.h"

View File

@ -16,9 +16,7 @@
#include "setup.h"
#include <sys/types.h>
#ifdef WIN32
#else
#if !defined(WIN32) || defined(WATT32)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

View File

@ -16,7 +16,7 @@
#include "setup.h"
#include <sys/types.h>
#ifdef WIN32
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <netinet/in.h>

View File

@ -16,7 +16,7 @@
#include "setup.h"
#include <sys/types.h>
#ifdef WIN32
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <netinet/in.h>

View File

@ -16,9 +16,7 @@
#include "setup.h"
#include <sys/types.h>
#ifdef WIN32
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif

View File

@ -16,9 +16,7 @@
#include "setup.h"
#include <stdlib.h>
#ifdef WIN32
#else
#if !defined(WIN32) || defined(WATT32)
#include <netdb.h>
#endif

View File

@ -16,19 +16,25 @@
#include "setup.h"
#include <sys/types.h>
#ifdef WIN32
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#include <iphlpapi.h>
#include <malloc.h>
#else
#include <sys/param.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <arpa/nameser.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#endif
#include <stdio.h>
#include <stdlib.h>
@ -39,6 +45,10 @@
#include "ares.h"
#include "ares_private.h"
#ifdef WATT32
#undef WIN32 /* Redefined in MingW/MSVC headers */
#endif
static int init_by_options(ares_channel channel, struct ares_options *options,
int optmask);
static int init_by_environment(ares_channel channel);

View File

@ -18,9 +18,7 @@
#include <stdio.h>
#include <sys/types.h>
#ifdef WIN32
#else
#if !defined(WIN32) || defined(WATT32)
#include <netinet/in.h>
/* We define closesocket() here so that we can use this function all over
the source code for closing sockets. */
@ -41,7 +39,7 @@
#define INADDR_NONE 0xffffffff
#endif
#ifdef WIN32
#if defined(WIN32) && !defined(WATT32)
#define IsNT ((int)GetVersion()>0)
#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"

View File

@ -16,27 +16,33 @@
#include "setup.h"
#include <sys/types.h>
#ifdef WIN32
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <sys/socket.h>
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/nameser.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#endif
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#include <errno.h>
#include "ares.h"
#include "ares_dns.h"
#include "ares_private.h"
#ifdef WIN32
#if defined(WIN32) || defined(WATT32)
#define GET_ERRNO() WSAGetLastError()
#else
#define GET_ERRNO() errno
@ -234,6 +240,7 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, time_t now)
*/
process_answer(channel, server->tcp_buffer, server->tcp_length,
i, 1, now);
if (server->tcp_buffer)
free(server->tcp_buffer);
server->tcp_buffer = NULL;
server->tcp_lenbuf_pos = 0;

View File

@ -16,7 +16,7 @@
#include "setup.h"
#include <sys/types.h>
#ifdef WIN32
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <netinet/in.h>

View File

@ -19,7 +19,7 @@
#include <string.h>
#include <ctype.h>
#ifdef WIN32
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#endif

View File

@ -16,7 +16,7 @@
#include "setup.h"
#include <sys/types.h>
#ifdef WIN32
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <netinet/in.h>

View File

@ -16,13 +16,12 @@
#include "setup.h"
#include <sys/types.h>
#ifdef WIN32
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <time.h>
#include "ares.h"
#include "ares_private.h"

View File

@ -221,16 +221,4 @@ typedef enum __ns_rcode {
#define T_MAILA ns_t_maila
#define T_ANY ns_t_any
#if !(defined(__MINGW32__) || defined(NETWARE))
/* protos for the functions we provide in windows_port.c */
int ares_strncasecmp(const char *s1, const char *s2, size_t n);
int ares_strcasecmp(const char *s1, const char *s2);
/* use this define magic to prevent us from adding symbol names to the library
that is a high-risk to collide with another libraries' attempts to do the
same */
#define strncasecmp(a,b,c) ares_strncasecmp(a,b,c)
#define strcasecmp(a,b) ares_strcasecmp(a,b)
#endif
#endif /* ARES_NAMESER_H */

View File

@ -19,6 +19,12 @@
#else
/* simple work-around for now, for systems without configure support */
#define ssize_t int
#ifdef __MINGW32__
#define HAVE_SYS_TIME_H
#define HAVE_UNISTD_H
#endif
#endif
/* Recent autoconf versions define these symbols in config.h. We don't want
@ -33,7 +39,7 @@
#undef PACKAGE
/* now typedef our socket type */
#ifdef WIN32
#if defined(WIN32) && !defined(WATT32)
#include <winsock.h>
typedef SOCKET ares_socket_t;
#define ARES_SOCKET_BAD INVALID_SOCKET
@ -42,4 +48,31 @@ typedef int ares_socket_t;
#define ARES_SOCKET_BAD -1
#endif
/* Assume a few thing unless they're set by configure
*/
#if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER)
#define HAVE_SYS_TIME_H
#endif
#if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
#define HAVE_UNISTD_H
#endif
#if !defined(HAVE_SYS_UIO_H) && !defined(WIN32)
#define HAVE_SYS_UIO_H
#endif
#if (defined(WIN32) || defined(WATT32)) && \
!(defined(__MINGW32__) || defined(NETWARE))
/* protos for the functions we provide in windows_port.c */
int ares_strncasecmp(const char *s1, const char *s2, int n);
int ares_strcasecmp(const char *s1, const char *s2);
/* use this define magic to prevent us from adding symbol names to the library
that is a high-risk to collide with another libraries' attempts to do the
same */
#define strncasecmp(a,b,c) ares_strncasecmp(a,b,c)
#define strcasecmp(a,b) ares_strcasecmp(a,b)
#endif
#endif /* ARES_SETUP_H */

View File

@ -1,6 +1,8 @@
#include "setup.h"
#ifdef WIN32 /* only do the following on windows */
/* only do the following on windows
*/
#if (defined(WIN32) || defined(WATT32)) && !defined(MSDOS)
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@ -8,13 +10,19 @@
#include <errno.h>
#include <malloc.h>
#ifdef WATT32
#include <sys/socket.h>
#else
#include "nameser.h"
#endif
#include "ares.h"
#include "ares_private.h"
#ifndef __MINGW32__
int
ares_strncasecmp(const char *a, const char *b, size_t n)
ares_strncasecmp(const char *a, const char *b, int n)
{
size_t i;
int i;
for (i = 0; i < n; i++) {
int c1 = isupper(a[i]) ? tolower(a[i]) : a[i];
@ -57,7 +65,7 @@ ares_gettimeofday(struct timeval *tv, struct timezone *tz)
}
int
ares_writev (SOCKET s, const struct iovec *vector, size_t count)
ares_writev (ares_socket_t s, const struct iovec *vector, size_t count)
{
char *buffer, *bp;
size_t i, bytes = 0;