bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix coreutils compilation with --disable-nls (long)


From: Paul Eggert
Subject: Re: [PATCH] Fix coreutils compilation with --disable-nls (long)
Date: 20 May 2003 11:45:36 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

address@hidden (Andrew Church) writes:

> The patch below fixes the programs in the coreutils package so that
> they compile and run correctly with --disable-nls when using a libc
> without locale support.
...
> +#if defined(ENABLE_NLS)
>    setlocale (LC_ALL, "");
>    bindtextdomain (PACKAGE, LOCALEDIR);
>    textdomain (PACKAGE);
> +#endif

I don't see why changes like this are needed, since lib/gettext.h does
this if ENABLE_NLS is not defined:

#  define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
#  define textdomain(Domainname) ((const char *) (Domainname))

and src/sys2.h does this if HAVE_LOCALE_H is not defined:

# define setlocale(Category, Locale) /* empty */

Is your problem that <locale.h> exists but setlocale does not?  Or is
it something else?  For example, what are the values of MB_CUR_MAX,
HAVE_MBRTOWC, HAVE_SETLOCALE, and HAVE_LOCALE_H on your host?  I'd
like to know exactly what the problem is, so that we can come up with
a smaller change to fix it (hopefully a fix just to an include file
somewhere).


> diff -urN coreutils-5.0-orig/src/ls.c coreutils-5.0/src/ls.c
> --- coreutils-5.0-orig/src/ls.c       2003-03-20 08:01:51 +0900
> +++ coreutils-5.0/src/ls.c    2003-05-21 01:22:15 +0900
> ...
> @@ -3158,6 +3160,7 @@
>               case 'p': case 'q': case 'r': case 's': case 't':
>               case 'u': case 'v': case 'w': case 'x': case 'y':
>               case 'z': case '{': case '|': case '}': case '~':
> +             case -0x5F ... -0x02:
>                 /* These characters are printable ASCII characters.  */
>                 *q++ = *p++;
>                 displayed_width += 1;
> @@ -3238,7 +3241,7 @@
>  
>         while (p < plimit)
>           {
> -           if (! ISPRINT ((unsigned char) *p))
> +           if (! ISPRINT ((unsigned char) *p) && !(*p >= -0x5F && *p <= -2))
>               *p = '?';
>             p++;
>           }

These changes aren't correct in general, since -0x5F through -0x02 are
not printable on all hosts.  Why are the changes needed for your host?
For example, does mbrtowc not work correctly on your host?  If so, how
does it fail?  (What host are you using, by the way?)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]