Re: /bin/ls formatting broken for non-C(?) locales

From: Andrey Chernov <ache_at_freebsd.org>
Date: Wed, 25 Nov 2015 04:50:54 +0300
On 25.11.2015 4:31, Andrey Chernov wrote:
> 4) The whole processing looks overcomplicated and not effective. What
> about this instead?
> for (i = 0; i < 12; i++) {
>     count wcswidth() of each month and store it in wab_months_width[].
>     count max_width_month.
> }
> for (i = 0; i < 12; i++) {
>     if ((n = max_width_month - wab_months_width[i]) > 0)
> 	call wcscat(wab_months[i], L" ") n times.
> }

Last line can be optimized further:
wcslcat(wab_months[i], L"     "/* MAX_ABMON_WIDTH */, n);

-- 
http://ache.vniz.net/


Received on Wed Nov 25 2015 - 00:51:04 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:01 UTC