Micah Cowan <[EMAIL PROTECTED]> writes:

> Also: the fix to the locale/progress-bar issues resulted in the
> added use of a couple wide-character/multibyte-related functions,
> mbtowc and wcwidth.

So far Wget has avoided explicit use of wc/mb functions on the account
of portability.  Fortunately in most cases we don't really care about
character representation of strings we use, progress.c being a notable
exception.  I suggest that we check for availability of multibyte
functions and, where missing, disable NLS and define stubs such as:

#ifndef HAVE_WCHAR_T
typedef char wchar_t
#endif
int
mbtowc(wchar_t *pwc, const char *s, size_t n)
{
  if (!s)
    return 0;
  if (pwc)
    *pwc = *s;
  return *s != '\0';
}

int
wcwidth(wchar_t c)
{
  return 1;
}

Disabling NLS should automatically diasble the use of multibyte
functions, as well as (probably) the other way around.  That should
ensure that Wget remain usable on platforms where NLS or wide-char
support or both are broken.  After all, for most users (even those who
don't speak English) Wget remains a simple command-line network
utility, and translations are not of utmost importance to that target
audience.

> [wcwidth] is defined in SUS, but not POSIX,

FWIW, the Linux man page lists it as conforming to POSIX.1-2001.

Reply via email to