#ifdef HAVE_HESIOD
#include <hesiod.h>
+#ifdef _WIN32
+/* This is declared in wshelper's resolv.h, but the definition of
+ * the putlong macro conflicts with Moira's
+ */
+struct hostent * WINAPI rgethostbyname(char *name);
+#endif
#endif
RCSID("$Header$");
int ok = 0;
int on = 1; /* Value variable for setsockopt() */
+#if defined(_WIN32) && defined(HAVE_HESIOD)
+ shost = rgethostbyname(server);
+#else
shost = gethostbyname(server);
+#endif
if (!shost)
goto cleanup;
int s, on = 1;
memset(&sin, 0, sizeof(sin));
+ sin.sin_family = AF_INET;
if (port[0] == '#')
sin.sin_port = atoi(port + 1);
else
if (s)
sin.sin_port = s->s_port;
else
+#ifndef HAVE_HESIOD
return -1;
+#else
+ {
+ s = hes_getservbyname(port, "tcp");
+ if (s)
+ sin.sin_port = s->s_port;
+ else
+ return -1;
+ }
+#endif /* HAVE_HESIOD */
}
-
+
s = socket(AF_INET, SOCK_STREAM, 0);
if (s < 0)
return -1;