+2003-10-11 Hrvoje Niksic <hniksic@xemacs.org>
+
+ * configure.in: Check for int32_t and u_int32_t. Check for
+ SIZEOF_INT.
+
2003-10-10 Hrvoje Niksic <hniksic@xemacs.org>
* aclocal.m4 (WGET_WITH_NLS): First check for gettext in libintl,
AC_TYPE_PID_T
AC_C_BIGENDIAN
-# Check size of long.
+dnl
+dnl Check integral type sizes.
+dnl
+AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
+AC_CHECK_TYPES(int32_t)
+AC_CHECK_TYPES(u_int32_t)
dnl
dnl Checks for headers
+2003-10-11 Hrvoje Niksic <hniksic@xemacs.org>
+
+ * host.c (lookup_host): Use u_int32_t to store the result of
+ inet_addr(). That removes the need for offset fiddling, caring
+ about endian-ness, etc.
+
+ * sysdep.h: Define int32_t and u_int32_t if not available.
+
2003-10-11 Hrvoje Niksic <hniksic@xemacs.org>
* ftp-basic.c (ftp_epsv): Use socklen_t * as the third argument to
significant byte first). */
#undef WORDS_BIGENDIAN
+/* Define to the length of int. */
+#undef SIZEOF_INT
+
/* Define to the length of long. */
#undef SIZEOF_LONG
/* Define if you want to enable the IPv6 support. */
#undef ENABLE_IPV6
-/* Define if you don't have socklen_t. */
+/* Defined to int or size_t on systems without socklen_t. */
#undef socklen_t
+/* Define if you have int32_t. */
+#undef HAVE_INT32_T
+
+/* Define if you have u_int32_t. */
+#undef HAVE_U_INT32_T
+
/* First a gambit to see whether we're on Solaris. We'll
need it below. */
#ifdef __sun
lookup_host (const char *host, int silent)
{
struct address_list *al = NULL;
- unsigned long addr_ipv4; /* #### use a 32-bit type here. */
+ u_int32_t addr_ipv4;
ip_address addr;
/* First, try to check whether the address is already a numeric
return address_list_from_single (&addr);
#endif
- addr_ipv4 = (unsigned long)inet_addr (host);
- if ((int)addr_ipv4 != -1)
+ addr_ipv4 = (u_int32_t)inet_addr (host);
+ if (addr_ipv4 != (u_int32_t)-1)
{
/* ADDR is defined to be in network byte order, which is what
- this returns, so we can just copy it to STORE_IP. However,
- on big endian 64-bit architectures the value will be stored
- in the *last*, not first four bytes. OFFSET makes sure that
- we copy the correct four bytes. */
- int offset = 0;
-#ifdef WORDS_BIGENDIAN
- offset = sizeof (unsigned long) - sizeof (ip4_address);
-#endif
- map_ipv4_to_ip ((ip4_address *)((char *)&addr_ipv4 + offset), &addr);
+ this returns, so we can just copy it to STORE_IP. */
+ map_ipv4_to_ip ((ip4_address *)&addr_ipv4, &addr);
return address_list_from_single (&addr);
}
if (host_name_addresses_map)
{
al = hash_table_get (host_name_addresses_map, host);
-
if (al)
{
DEBUGP (("Found %s in host_name_addresses_map (%p)\n", host, al));
int fnmatch ();
#endif
+/* Provide 32-bit types for the code that really needs it. */
+
+#ifndef HAVE_INT32_T
+# if SIZEOF_INT == 4
+typedef int int32_t;
+# else
+# if SIZEOF_LONG == 4
+typedef long int32_t;
+# else
+ "Cannot determine a 32-bit type"
+# endif
+# endif
+#endif
+
+#ifndef HAVE_U_INT32_T
+# if SIZEOF_INT == 4
+typedef unsigned int u_int32_t;
+# else
+# if SIZEOF_LONG == 4
+typedef unsigned long u_int32_t;
+# else
+ "Cannot determine a 32-bit type"
+# endif
+# endif
+#endif
+
#endif /* SYSDEP_H */