1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Updated long_to_string(); enhanced opt.downloaded to use

64-bit types where available.
Published in <sxswvenqsmn.fsf@florida.arsdigita.de> and
<sxssnpbqshp.fsf@florida.arsdigita.de>.
This commit is contained in:
hniksic 2000-11-01 13:51:25 -08:00
parent b9eeb0c54c
commit 29cdc8da20
10 changed files with 282 additions and 103 deletions

View File

@ -1,3 +1,7 @@
2000-11-01 Hrvoje Niksic <hniksic@arsdigita.com>
* configure.in: Check for size of long and long long.
2000-10-30 Dan Harkless <dan-wget@dilvish.speed.net> 2000-10-30 Dan Harkless <dan-wget@dilvish.speed.net>
* NEWS: Hrvoje pointed out that relative URL grokking deserves mention. * NEWS: Hrvoje pointed out that relative URL grokking deserves mention.

218
configure vendored
View File

@ -1542,21 +1542,101 @@ EOF
fi fi
# Check size of long.
echo $ac_n "checking size of long""... $ac_c" 1>&6
echo "configure:1548: checking size of long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
#line 1556 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", sizeof(long));
exit(0);
}
EOF
if { (eval echo configure:1567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long=`cat conftestval`
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
ac_cv_sizeof_long=0
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$ac_cv_sizeof_long" 1>&6
cat >> confdefs.h <<EOF
#define SIZEOF_LONG $ac_cv_sizeof_long
EOF
echo $ac_n "checking size of long long""... $ac_c" 1>&6
echo "configure:1587: checking size of long long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
#line 1595 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", sizeof(long long));
exit(0);
}
EOF
if { (eval echo configure:1606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_long=`cat conftestval`
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
ac_cv_sizeof_long_long=0
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6
cat >> confdefs.h <<EOF
#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
EOF
for ac_hdr in string.h stdarg.h unistd.h sys/time.h utime.h sys/utime.h for ac_hdr in string.h stdarg.h unistd.h sys/time.h utime.h sys/utime.h
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1550: checking for $ac_hdr" >&5 echo "configure:1630: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1555 "configure" #line 1635 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1560: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
@ -1586,17 +1666,17 @@ for ac_hdr in sys/select.h sys/utsname.h pwd.h signal.h
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1590: checking for $ac_hdr" >&5 echo "configure:1670: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1595 "configure" #line 1675 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1680: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
@ -1623,12 +1703,12 @@ fi
done done
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
echo "configure:1627: checking whether time.h and sys/time.h may both be included" >&5 echo "configure:1707: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1632 "configure" #line 1712 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
@ -1637,7 +1717,7 @@ int main() {
struct tm *tp; struct tm *tp;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1641: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1721: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ac_cv_header_time=yes ac_cv_header_time=yes
else else
@ -1659,12 +1739,12 @@ fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
echo "configure:1663: checking return type of signal handlers" >&5 echo "configure:1743: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1668 "configure" #line 1748 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#include <signal.h> #include <signal.h>
@ -1681,7 +1761,7 @@ int main() {
int i; int i;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1765: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ac_cv_type_signal=void ac_cv_type_signal=void
else else
@ -1701,10 +1781,10 @@ EOF
echo $ac_n "checking for struct utimbuf""... $ac_c" 1>&6 echo $ac_n "checking for struct utimbuf""... $ac_c" 1>&6
echo "configure:1705: checking for struct utimbuf" >&5 echo "configure:1785: checking for struct utimbuf" >&5
if test x"$ac_cv_header_utime_h" = xyes; then if test x"$ac_cv_header_utime_h" = xyes; then
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1708 "configure" #line 1788 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <utime.h> #include <utime.h>
EOF EOF
@ -1729,19 +1809,19 @@ fi
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless! # for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
echo "configure:1733: checking for working alloca.h" >&5 echo "configure:1813: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1738 "configure" #line 1818 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <alloca.h> #include <alloca.h>
int main() { int main() {
char *p = alloca(2 * sizeof(int)); char *p = alloca(2 * sizeof(int));
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:1825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
ac_cv_header_alloca_h=yes ac_cv_header_alloca_h=yes
else else
@ -1762,12 +1842,12 @@ EOF
fi fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6 echo $ac_n "checking for alloca""... $ac_c" 1>&6
echo "configure:1766: checking for alloca" >&5 echo "configure:1846: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1771 "configure" #line 1851 "configure"
#include "confdefs.h" #include "confdefs.h"
#ifdef __GNUC__ #ifdef __GNUC__
@ -1795,7 +1875,7 @@ int main() {
char *p = (char *) alloca(1); char *p = (char *) alloca(1);
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:1879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
ac_cv_func_alloca_works=yes ac_cv_func_alloca_works=yes
else else
@ -1827,12 +1907,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
echo "configure:1831: checking whether alloca needs Cray hooks" >&5 echo "configure:1911: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1836 "configure" #line 1916 "configure"
#include "confdefs.h" #include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2) #if defined(CRAY) && ! defined(CRAY2)
webecray webecray
@ -1857,12 +1937,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1861: checking for $ac_func" >&5 echo "configure:1941: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1866 "configure" #line 1946 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -1885,7 +1965,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:1969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -1912,7 +1992,7 @@ done
fi fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
echo "configure:1916: checking stack direction for C alloca" >&5 echo "configure:1996: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1920,7 +2000,7 @@ else
ac_cv_c_stack_direction=0 ac_cv_c_stack_direction=0
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1924 "configure" #line 2004 "configure"
#include "confdefs.h" #include "confdefs.h"
find_stack_direction () find_stack_direction ()
{ {
@ -1939,7 +2019,7 @@ main ()
exit (find_stack_direction() < 0); exit (find_stack_direction() < 0);
} }
EOF EOF
if { (eval echo configure:1943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:2023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_c_stack_direction=1 ac_cv_c_stack_direction=1
else else
@ -1963,12 +2043,12 @@ fi
for ac_func in strdup strstr strcasecmp strncasecmp for ac_func in strdup strstr strcasecmp strncasecmp
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1967: checking for $ac_func" >&5 echo "configure:2047: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1972 "configure" #line 2052 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -1991,7 +2071,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:2075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -2018,12 +2098,12 @@ done
for ac_func in gettimeofday mktime strptime for ac_func in gettimeofday mktime strptime
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2022: checking for $ac_func" >&5 echo "configure:2102: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2027 "configure" #line 2107 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -2046,7 +2126,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:2130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -2073,12 +2153,12 @@ done
for ac_func in strerror vsnprintf select signal symlink access isatty for ac_func in strerror vsnprintf select signal symlink access isatty
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2077: checking for $ac_func" >&5 echo "configure:2157: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2082 "configure" #line 2162 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -2101,7 +2181,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:2185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -2128,12 +2208,12 @@ done
for ac_func in uname gethostname for ac_func in uname gethostname
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2132: checking for $ac_func" >&5 echo "configure:2212: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2137 "configure" #line 2217 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -2156,7 +2236,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2160: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:2240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -2184,12 +2264,12 @@ done
for ac_func in gethostbyname for ac_func in gethostbyname
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2188: checking for $ac_func" >&5 echo "configure:2268: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2193 "configure" #line 2273 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -2212,7 +2292,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:2296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -2234,7 +2314,7 @@ EOF
else else
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
echo "configure:2238: checking for gethostbyname in -lnsl" >&5 echo "configure:2318: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -2242,7 +2322,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS" LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2246 "configure" #line 2326 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -2253,7 +2333,7 @@ int main() {
gethostbyname() gethostbyname()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:2337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -2287,7 +2367,7 @@ done
echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
echo "configure:2291: checking for socket in -lsocket" >&5 echo "configure:2371: checking for socket in -lsocket" >&5
ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -2295,7 +2375,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS" LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2299 "configure" #line 2379 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -2306,7 +2386,7 @@ int main() {
socket() socket()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:2390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -2337,7 +2417,7 @@ fi
if test "x${with_socks}" = xyes if test "x${with_socks}" = xyes
then then
echo $ac_n "checking for main in -lresolv""... $ac_c" 1>&6 echo $ac_n "checking for main in -lresolv""... $ac_c" 1>&6
echo "configure:2341: checking for main in -lresolv" >&5 echo "configure:2421: checking for main in -lresolv" >&5
ac_lib_var=`echo resolv'_'main | sed 'y%./+-%__p_%'` ac_lib_var=`echo resolv'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -2345,14 +2425,14 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS" LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2349 "configure" #line 2429 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
main() main()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:2436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -2380,7 +2460,7 @@ else
fi fi
echo $ac_n "checking for Rconnect in -lsocks""... $ac_c" 1>&6 echo $ac_n "checking for Rconnect in -lsocks""... $ac_c" 1>&6
echo "configure:2384: checking for Rconnect in -lsocks" >&5 echo "configure:2464: checking for Rconnect in -lsocks" >&5
ac_lib_var=`echo socks'_'Rconnect | sed 'y%./+-%__p_%'` ac_lib_var=`echo socks'_'Rconnect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -2388,7 +2468,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lsocks $LIBS" LIBS="-lsocks $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2392 "configure" #line 2472 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -2399,7 +2479,7 @@ int main() {
Rconnect() Rconnect()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:2483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -2431,7 +2511,7 @@ fi
ALL_LINGUAS="cs de hr it no pl pt_BR ru" ALL_LINGUAS="cs de hr it no pl pt_BR ru"
echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
echo "configure:2435: checking whether NLS is requested" >&5 echo "configure:2515: checking whether NLS is requested" >&5
# Check whether --enable-nls or --disable-nls was given. # Check whether --enable-nls or --disable-nls was given.
if test "${enable_nls+set}" = set; then if test "${enable_nls+set}" = set; then
enableval="$enable_nls" enableval="$enable_nls"
@ -2448,7 +2528,7 @@ fi
# Extract the first word of "msgfmt", so it can be a program name with args. # Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2 set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2452: checking for $ac_word" >&5 echo "configure:2532: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -2482,7 +2562,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args. # Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2 set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2486: checking for $ac_word" >&5 echo "configure:2566: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -2517,7 +2597,7 @@ fi
# Extract the first word of "gmsgfmt", so it can be a program name with args. # Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2 set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2521: checking for $ac_word" >&5 echo "configure:2601: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -2567,17 +2647,17 @@ fi
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2571: checking for $ac_hdr" >&5 echo "configure:2651: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2576 "configure" #line 2656 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2581: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:2661: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
@ -2607,12 +2687,12 @@ done
for ac_func in gettext for ac_func in gettext
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2611: checking for $ac_func" >&5 echo "configure:2691: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2616 "configure" #line 2696 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -2635,7 +2715,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:2719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -2657,7 +2737,7 @@ EOF
else else
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6 echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6
echo "configure:2661: checking for gettext in -lintl" >&5 echo "configure:2741: checking for gettext in -lintl" >&5
ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'` ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -2665,7 +2745,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS" LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2669 "configure" #line 2749 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -2676,7 +2756,7 @@ int main() {
gettext() gettext()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:2760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -2744,7 +2824,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2748: checking for $ac_word" >&5 echo "configure:2828: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else

View File

@ -136,6 +136,10 @@ AC_TYPE_PID_T
dnl #### This generates a warning. What do I do to shut it up? dnl #### This generates a warning. What do I do to shut it up?
AC_C_BIGENDIAN AC_C_BIGENDIAN
# Check size of long.
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
dnl dnl
dnl Checks for headers dnl Checks for headers
dnl dnl

View File

@ -1,3 +1,27 @@
2000-11-01 Hrvoje Niksic <hniksic@arsdigita.com>
* main.c (main): Use legible_very_long() for printing
opt.downloaded.
* utils.c (legible_1): New function that operates on strings and
does the brunt of legible()'s work.
(legible): Use legible_1().
(legible_very_long): New function; dump the argument with
sprintf(), and call legible_1().
* options.h (struct options): Use VERY_LONG_TYPE for
opt.downloaded.
* sysdep.h (VERY_LONG_TYPE): Define it to have a 64-bit or greater
type.
* config.h.in: Make sure that SIZEOF_LONG and SIZEOF_LONG_LONG get
defined. Define HAVE_LONG_LONG if long long is available.
2000-11-01 Hrvoje Niksic <hniksic@arsdigita.com>
* utils.c (long_to_string): Update with a later, better version.
2000-11-01 Hrvoje Niksic <hniksic@arsdigita.com> 2000-11-01 Hrvoje Niksic <hniksic@arsdigita.com>
* url.c (path_simplify_with_kludge): New function. * url.c (path_simplify_with_kludge): New function.

View File

@ -66,6 +66,17 @@ char *alloca ();
significant byte first). */ significant byte first). */
#undef WORDS_BIGENDIAN #undef WORDS_BIGENDIAN
/* Define to the length of long. */
#undef SIZEOF_LONG
/* Define to the length of long long. */
#undef SIZEOF_LONG_LONG
#undef HAVE_LONG_LONG
#if SIZEOF_LONG_LONG != 0
# define HAVE_LONG_LONG
#endif
/* Define this if you want the NLS support. */ /* Define this if you want the NLS support. */
#undef HAVE_NLS #undef HAVE_NLS

View File

@ -771,7 +771,8 @@ Can't timestamp and not clobber old files at the same time.\n"));
{ {
logprintf (LOG_NOTQUIET, logprintf (LOG_NOTQUIET,
_("\nFINISHED --%s--\nDownloaded: %s bytes in %d files\n"), _("\nFINISHED --%s--\nDownloaded: %s bytes in %d files\n"),
time_str (NULL), legible (opt.downloaded), opt.numurls); time_str (NULL), legible_very_long (opt.downloaded),
opt.numurls);
/* Print quota warning, if exceeded. */ /* Print quota warning, if exceeded. */
if (opt.quota && opt.downloaded > opt.quota) if (opt.quota && opt.downloaded > opt.quota)
logprintf (LOG_NOTQUIET, logprintf (LOG_NOTQUIET,

View File

@ -104,7 +104,7 @@ struct options
long quota; /* Maximum number of bytes to long quota; /* Maximum number of bytes to
retrieve. */ retrieve. */
long downloaded; /* How much we downloaded already. */ VERY_LONG_TYPE downloaded; /* How much we downloaded already. */
int numurls; /* Number of successfully downloaded int numurls; /* Number of successfully downloaded
URLs */ URLs */

View File

@ -97,8 +97,22 @@ do { \
DEBUGP (("Closing fd %d\n", x)); \ DEBUGP (("Closing fd %d\n", x)); \
} while (0) } while (0)
/* Define a "very long" type useful for storing large non-negative
integers, e.g. the total number of bytes downloaded. This needs to
be an integral type at least 64 bits wide. On the machines where
`long' is 64-bit, we use long. Otherwise, we check whether `long
long' is available and if yes, use that. Otherwise, we give up and
just use `long'. */
#if (SIZEOF_LONG >= 8) || !defined(HAVE_LONG_LONG)
# define VERY_LONG_TYPE unsigned long
# define VERY_LONG_FORMAT "%lu"
#else /* long is smaller than 8 bytes, but long long is available. */
# define VERY_LONG_TYPE unsigned long long
# define VERY_LONG_FORMAT "%llu"
#endif /* use long long */
/* OK, now define a decent interface to ctype macros. The regular /* OK, now define a decent interface to ctype macros. The regular
ones misfire when you feed them chars >= 127, as they understand ones misfire when you feed them chars > 127, as they understand
them as "negative", which results in out-of-bound access at them as "negative", which results in out-of-bound access at
table-lookup, yielding random results. This is, of course, totally table-lookup, yielding random results. This is, of course, totally
bogus. One way to "solve" this is to use `unsigned char' bogus. One way to "solve" this is to use `unsigned char'

View File

@ -896,21 +896,21 @@ free_slist (slist *l)
l = n; l = n;
} }
} }
/* Engine for legible and legible_long_long; this function works on
strings. */
/* Legible -- return a static pointer to the legibly printed long. */ static char *
char * legible_1 (const char *repr)
legible (long l)
{ {
static char outbuf[20]; static char outbuf[128];
char inbuf[20];
int i, i1, mod; int i, i1, mod;
char *outptr, *inptr; char *outptr;
const char *inptr;
/* Print the number into the buffer. */
long_to_string (inbuf, l);
/* Reset the pointers. */ /* Reset the pointers. */
outptr = outbuf; outptr = outbuf;
inptr = inbuf; inptr = repr;
/* If the number is negative, shift the pointers. */ /* If the number is negative, shift the pointers. */
if (*inptr == '-') if (*inptr == '-')
{ {
@ -935,6 +935,26 @@ legible (long l)
return outbuf; return outbuf;
} }
/* Legible -- return a static pointer to the legibly printed long. */
char *
legible (long l)
{
char inbuf[24];
/* Print the number into the buffer. */
long_to_string (inbuf, l);
return legible_1 (inbuf);
}
/* The same as legible(), but works on VERY_LONG_TYPE. See sysdep.h. */
char *
legible_very_long (VERY_LONG_TYPE l)
{
char inbuf[128];
/* Print the number into the buffer. */
sprintf (inbuf, VERY_LONG_FORMAT, l);
return legible_1 (inbuf);
}
/* Count the digits in a (long) integer. */ /* Count the digits in a (long) integer. */
int int
numdigit (long a) numdigit (long a)
@ -945,34 +965,54 @@ numdigit (long a)
return res; return res;
} }
/* Print NUMBER to BUFFER. The digits are first written in reverse /* Print NUMBER to BUFFER. This is equivalent to sprintf(buffer,
order (the least significant digit first), and are then reversed. */ "%ld", number), only much faster.
BUFFER should accept 24 bytes. This should suffice for the longest
numbers on 64-bit machines, including the `-' sign and the trailing
\0. */
void void
long_to_string (char *buffer, long number) long_to_string (char *buffer, long number)
{ {
char *p; #if (SIZEOF_LONG != 4) && (SIZEOF_LONG != 8)
int i, l; /* Huh? */
sprintf (buffer, "%ld", number);
#else /* (SIZEOF_LONG == 4) || (SIZEOF_LONG == 8) */
char *p = buffer;
int force = 0;
if (number < 0) if (number < 0)
{ {
*buffer++ = '-'; *p++ = '-';
number = -number; number = -number;
} }
p = buffer;
/* Print the digits to the string. */ #define FROB(figure) do { \
do if (force || number >= figure) \
{ *p++ = number / figure + '0', number %= figure, force = 1; \
*p++ = number % 10 + '0'; } while (0)
number /= 10; #if SIZEOF_LONG == 8
} FROB (1000000000000000000L);
while (number); FROB (100000000000000000L);
/* And reverse them. */ FROB (10000000000000000L);
l = p - buffer - 1; FROB (1000000000000000L);
for (i = l/2; i >= 0; i--) FROB (100000000000000L);
{ FROB (10000000000000L);
char c = buffer[i]; FROB (1000000000000L);
buffer[i] = buffer[l - i]; FROB (100000000000L);
buffer[l - i] = c; FROB (10000000000L);
} #endif /* SIZEOF_LONG == 8 */
buffer[l + 1] = '\0'; FROB (1000000000);
FROB (100000000);
FROB (10000000);
FROB (1000000);
FROB (100000);
FROB (10000);
FROB (1000);
FROB (100);
FROB (10);
#undef FROB
*p++ = number + '0';
*p = '\0';
#endif /* (SIZEOF_LONG == 4) || (SIZEOF_LONG == 8) */
} }

View File

@ -67,6 +67,7 @@ int in_slist PARAMS ((slist *, const char *));
void free_slist PARAMS ((slist *)); void free_slist PARAMS ((slist *));
char *legible PARAMS ((long)); char *legible PARAMS ((long));
char *legible_very_long PARAMS ((VERY_LONG_TYPE));
int numdigit PARAMS ((long)); int numdigit PARAMS ((long));
void long_to_string PARAMS ((char *, long)); void long_to_string PARAMS ((char *, long));