[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: misalignment in ls -l in fr_FR locale
From: |
Jim Meyering |
Subject: |
Re: misalignment in ls -l in fr_FR locale |
Date: |
Thu, 26 Mar 2009 13:21:08 +0100 |
Pádraig Brady wrote:
...
> +/* In the unlikely event that the abmon[] storage is not big enough
> + an error message will be displayed, and we revert to using
> + unmodified abbreviated month names from the locale database. */
> +static char abmon[12][MAX_MON_WIDTH * 2 * MB_LEN_MAX + 1];
> +/* minimum width needed to align %b, 0 => don't use precomputed values. */
> +static int required_mon_width;
> +
> +static void
> +abmon_init (void)
> +{
> +#ifdef HAVE_NL_LANGINFO
> + required_mon_width = MAX_MON_WIDTH;
> + int curr_max_width;
> + do
> + {
> + curr_max_width = required_mon_width;
> + required_mon_width = 0;
> + for (int i = 0; i < 12; i++)
> + {
> + int width = curr_max_width;
> +
> + int req = mbsalign (nl_langinfo (ABMON_1 + i),
> + abmon[i], sizeof (abmon[i]),
> + &width, MBS_ALIGN_LEFT);
> +
> + if (req >= sizeof(abmon[i]))
> + {
> + error (0, 0, _("overflow initializing month strings"));
> + required_mon_width = 0; /* ignore precomputed strings. */
> + return;
It's usually best to avoid "void" functions.
In this case, to be more library friendly, it should avoid
calling error, and simply return an indication of failure.
- Re: misalignment in ls -l in fr_FR locale, (continued)
- Re: misalignment in ls -l in fr_FR locale, Samuel Thibault, 2009/03/20
- Re: misalignment in ls -l in fr_FR locale, Pádraig Brady, 2009/03/20
- Re: misalignment in ls -l in fr_FR locale, Pádraig Brady, 2009/03/23
- Re: misalignment in ls -l in fr_FR locale, Pádraig Brady, 2009/03/24
- Re: misalignment in ls -l in fr_FR locale, Pádraig Brady, 2009/03/24
- Re: misalignment in ls -l in fr_FR locale, Pádraig Brady, 2009/03/25
- Re: misalignment in ls -l in fr_FR locale, Jim Meyering, 2009/03/26
- Re: misalignment in ls -l in fr_FR locale, Jim Meyering, 2009/03/26
- Re: misalignment in ls -l in fr_FR locale, Pádraig Brady, 2009/03/26
- Re: misalignment in ls -l in fr_FR locale, Jim Meyering, 2009/03/26
- Re: misalignment in ls -l in fr_FR locale,
Jim Meyering <=
- Re: misalignment in ls -l in fr_FR locale, Pádraig Brady, 2009/03/27
- Re: misalignment in ls -l in fr_FR locale, Stéphane Raimbault, 2009/03/27
- Re: misalignment in ls -l in fr_FR locale, Jim Meyering, 2009/03/28