5 /* only do the following on windows
7 #if (defined(WIN32) || defined(WATT32)) && !defined(MSDOS)
16 #include <sys/socket.h>
21 #include "ares_private.h"
25 * Watcom needs a DllMain() in order to initialise the clib startup code.
28 WINAPI DllMain (HINSTANCE hnd, DWORD reason, LPVOID reserved)
39 ares_strncasecmp(const char *a, const char *b, int n)
43 for (i = 0; i < n; i++) {
44 int c1 = ISUPPER(a[i]) ? tolower(a[i]) : a[i];
45 int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i];
46 if (c1 != c2) return c1-c2;
52 ares_strcasecmp(const char *a, const char *b)
54 return strncasecmp(a, b, strlen(a)+1);
59 ares_writev (ares_socket_t s, const struct iovec *vector, size_t count)
64 /* Find the total number of bytes to write
66 for (i = 0; i < count; i++)
67 bytes += vector[i].iov_len;
69 if (bytes == 0) /* not an error */
72 /* Allocate a temporary buffer to hold the data
74 buffer = bp = (char*) alloca (bytes);
81 /* Copy the data into buffer.
83 for (i = 0; i < count; ++i)
85 memcpy (bp, vector[i].iov_base, vector[i].iov_len);
86 bp += vector[i].iov_len;
88 return (int)swrite(s, buffer, bytes);
90 #endif /* WIN32 builds only */