[PATCH] Properly display unavailable elements in LC_MONETARY category
Ondřej Bílka
neleai@seznam.cz
Mon Nov 18 16:19:00 GMT 2013
On Thu, Nov 14, 2013 at 03:50:40PM +0100, Andreas Schwab wrote:
> LC_MONETARY mon_grouping and LC_NUMERIC grouping use both \177 and \377
> as special markers, where \177 is used for -1, and \377 is used instead
> of 0 (even though 0 for grouping has no meaning). __guess_grouping in
> printf_fp.c interpretes both as the end of grouping.
>
> For integer-valued elements localedef always emits "\377" for
> unavailable values (locale file contents should not depend on the
> signedness of char). This means that C-monetary should use "\377" even
> on signed architectures, and localeconv needs to convert to the
> POSIX-mandated CHAR_MAX. Further fixes are needed for strfmon to be
> independent of signedness.
>
> Andreas.
>
> * locale/programs/locale.c (show_info) [case byte]: Check for
> '\377' instead of '\177'.
> * locale/C-monetary.c (not_available): Always use "\377".
> * stdlib/strfmon_l.c (__vstrfmon_l): Use -2 as marker for
> unspecified p_sign_posn and n_sign_posn. Check for '\377' to
> detect unavailable sign_posn locale elements.
> * locale/localeconv.c (__localeconv): For grouping and
> mon_grouping handle "\177" and "\377" like no grouping.
> (INT_ELEM): New macro. Use it to set all numeric members.
> * locale/programs/ld-monetary.c (monetary_read)
> <tok_mon_grouping>: Normalize single -1 to the empty string.
> * locale/programs/ld-numeric.c (numeric_read) <tok_grouping>:
> Likewise.
>
looks ok.
More information about the Libc-alpha
mailing list