On Fri, Aug 12, 2005 at 06:00:13PM +0200, Hrvoje Niksic wrote:
> Albert Chin <[EMAIL PROTECTED]> writes:
>
> > We have something working now. I'll send a patch in a bit.
>
> Thanks.
Better late than never :)
Patch below against trunk.
The src/wget.h changes are cosmetic and can be ignored if you want.
--
albert chin ([EMAIL PROTECTED])
-- snip snip
Index: configure.in
===================================================================
--- configure.in (revision 2063)
+++ configure.in (working copy)
@@ -205,8 +205,21 @@
AC_FUNC_MMAP
AC_FUNC_FSEEKO
AC_CHECK_FUNCS(strptime timegm snprintf vsnprintf vasprintf drand48)
-AC_CHECK_FUNCS(strtoll strtoimax usleep ftello sigblock sigsetjmp)
+AC_CHECK_FUNCS(usleep ftello sigblock sigsetjmp)
+AC_CHECK_FUNCS(strtoll, , [
+ dnl The following taken from gnulib:
+ dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ AC_MSG_CHECKING([whether <inttypes.h> defines strtoimax as a macro])
+ AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h>
+#ifdef strtoimax
+ inttypes_h_defines_strtoimax
+#endif], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_STRTOIMAX, 1,
+ [Define to 1 if you have the `strtoimax'.])], [
+ AC_MSG_RESULT(no)])])
+
dnl We expect to have these functions on Unix-like systems configure
dnl runs on. The defines are provided to get them in config.h.in so
dnl Wget can still be ported to non-Unix systems (such as Windows)
Index: src/wget.h
===================================================================
--- src/wget.h (revision 2063)
+++ src/wget.h (working copy)
@@ -134,12 +134,14 @@
# define WGINT_MAX LLONG_MAX
# ifdef HAVE_STRTOLL
# define str_to_wgint strtoll
-# elif defined HAVE_STRTOIMAX /* HPUX 11.0 has strtoimax, but no strtoll */
-# define str_to_wgint strtoimax
# else
-# define str_to_wgint strtoll
-# define NEED_STRTOLL
-# define strtoll_type long long
+# ifdef HAVE_STRTOIMAX /* HPUX 11.0.0 has strtoimax, but not strtoll */
+# define str_to_wgint strtoimax
+# else
+# define str_to_wgint strtoll
+# define NEED_STRTOLL
+# define strtoll_type long long
+# endif
# endif
# endif
#endif /* not WINDOWS */
Index: src/cmpt.c
===================================================================
--- src/cmpt.c (revision 2063)
+++ src/cmpt.c (working copy)
@@ -1270,12 +1270,13 @@
#ifdef NEED_STRTOLL
/* strtoll is required by C99 and used by Wget only on systems with
LFS. Unfortunately, some systems have LFS, but no strtoll or
- equivalent. These include HPUX 11.0 and Windows.
+ equivalent (e.g. Windows).
- We use #ifdef NEED_STRTOLL instead of #ifndef HAVE_STRTOLL because
- of the systems which have a suitable replacement (e.g. _strtoi64 on
- Windows), on which Wget's str_to_wgint is instructed to use that
- instead. */
+ We use #ifdef NEED_STRTOLL instead of:
+ #if !defined(HAVE_STRTOLL) && !defined(HAVE_STRTOIMAX)
+ because of systems which have a suitable replacement (e.g.
+ _strtoi64 on Windows) or where strtol() is sufficent, on which Wget's
+ str_to_wgint is instructed to use that instead. */
static inline int
char_value (char c, int base)