+2002-02-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * socket-io.c: Don't conditionally include sys/filio.h or
+ sys/sockio.h here anymore since we now get them from
+ io-layer/io-layer.h
+ (inet_pton): If the system doesn't support inet_aton, implement
+ using inet_addr and also #define INADDR_NONE if it isn't defined
+ by the system.
Thu Feb 14 19:01:06 CET 2002 Paolo Molaro <lupus@ximian.com>
#include <sys/time.h>
-#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h> /* defines FIONBIO and FIONREAD */
-#endif
-#ifdef HAVE_SYS_SOCKIO_H
-#include <sys/sockio.h> /* defines SIOCATMARK */
-#endif
-
#undef DEBUG
static gint32 convert_family(MonoAddressFamily mono_family)
inet_pton (int family, const char *address, void *inaddrp)
{
if (family == AF_INET) {
+#ifdef HAVE_INET_ATON
struct in_addr inaddr;
if (!inet_aton (address, &inaddr))
memcpy (inaddrp, &inaddr, sizeof (struct in_addr));
return 1;
+#else
+ /* assume the system has inet_addr(), if it doesn't
+ have that we're pretty much screwed... */
+ in_addr_t inaddr;
+
+ if (!strcmp (address, "255.255.255.255")) {
+ /* special-case hack */
+ inaddr = 0xffffffff;
+ } else {
+ inaddr = inet_addr (address);
+#ifndef INADDR_NONE
+#define INADDR_NONE ((in_addr_t) -1)
+#endif
+ if (inaddr == INADDR_NONE)
+ return 0;
+ }
+
+ memcpy (inaddrp, &inaddr, sizeof (in_addr_t));
+ return 1;
+#endif /* HAVE_INET_ATON */
}
errno = EAFNOSUPPRT;