From 35b72cc941175a2c13989c7d1e5a77a948d5c432 Mon Sep 17 00:00:00 2001 From: Micah Cowan Date: Sun, 3 Feb 2008 01:48:50 -0800 Subject: [PATCH] Handle missing wchar.h, wcwidth. --- ChangeLog | 5 +++++ configure.ac | 4 ++-- src/progress.c | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bbbb06c..ae985fba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-03 Micah Cowan + + * configure.in: Add checks for wchar.h, wcwidth function (to + support column-counting in progress.c). + 2008-01-31 Micah Cowan * util/README, util/dist-wget, util/download-netscape.html, diff --git a/configure.ac b/configure.ac index e98e6b32..5e7e7a2f 100644 --- a/configure.ac +++ b/configure.ac @@ -159,7 +159,7 @@ dnl AC_HEADER_STDBOOL AC_CHECK_HEADERS(unistd.h sys/time.h) AC_CHECK_HEADERS(termios.h sys/ioctl.h sys/select.h utime.h sys/utime.h) -AC_CHECK_HEADERS(stdint.h inttypes.h pwd.h) +AC_CHECK_HEADERS(stdint.h inttypes.h pwd.h wchar.h) dnl dnl Check sizes of integer types. These are used to find n-bit @@ -197,7 +197,7 @@ AC_FUNC_ALLOCA AC_FUNC_MMAP AC_FUNC_FSEEKO AC_CHECK_FUNCS(strptime timegm snprintf vsnprintf vasprintf drand48) -AC_CHECK_FUNCS(strtoll usleep ftello sigblock sigsetjmp memrchr) +AC_CHECK_FUNCS(strtoll usleep ftello sigblock sigsetjmp memrchr wcwidth) if test x"$ENABLE_OPIE" = xyes; then AC_LIBOBJ([ftp-opie]) diff --git a/src/progress.c b/src/progress.c index a06f73d3..d77f99b6 100644 --- a/src/progress.c +++ b/src/progress.c @@ -38,6 +38,9 @@ as that of the covered work. */ # include #endif #include +#ifdef HAVE_WCHAR_H +# include +#endif #include "progress.h" #include "utils.h" @@ -764,6 +767,10 @@ update_speed_ring (struct bar_progress *bp, wgint howmuch, double dltime) #endif } +#if ! HAVE_WCWIDTH +#define wcwidth(wc) (1) +#endif + int count_cols (const char *mbs) { -- 2.39.2