X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2Funicodeio.c;h=a1db6e282dd8828f5f79b8355dbb39abd7d1291f;hb=fb1c65e512181db1c43c19c708a8e1c795cbd31c;hp=4300df556e0fb7fc1dc941bb08ea055e07b8b392;hpb=1b10ab140fdb1184462b2e302560f430bcec7f38;p=chaz%2Ftar diff --git a/lib/unicodeio.c b/lib/unicodeio.c index 4300df5..a1db6e2 100644 --- a/lib/unicodeio.c +++ b/lib/unicodeio.c @@ -37,15 +37,23 @@ #ifndef errno extern int errno; #endif + +#if HAVE_ICONV +# include +#endif + +/* Some systems, like SunOS 4, don't have EILSEQ. On these systems, + define EILSEQ to some value other than EINVAL, because our invokers + may want to distinguish EINVAL from EILSEQ. */ #ifndef EILSEQ -# define EILSEQ EINVAL +# define EILSEQ ENOENT #endif #ifndef ENOTSUP # define ENOTSUP EINVAL #endif -#if HAVE_ICONV -# include +#if HAVE_LANGINFO_CODESET && ! USE_INCLUDED_LIBINTL +# include #endif #include "unicodeio.h" @@ -126,8 +134,18 @@ unicode_to_mb (unsigned int code, if (!initialized) { + const char *charset; + +#if USE_INCLUDED_LIBINTL extern const char *locale_charset PARAMS ((void)); - const char *charset = locale_charset (); + charset = locale_charset (); +#else +# if HAVE_LANGINFO_CODESET + charset = nl_langinfo (CODESET); +# else + charset = ""; +# endif +#endif is_utf8 = !strcmp (charset, UTF8_NAME); #if HAVE_ICONV