/bin/ls formatting broken for non-C(?) locales
Andrey Chernov
ache at freebsd.org
Wed Nov 25 01:51:04 UTC 2015
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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20151125/add2c9a6/attachment.bin>
More information about the freebsd-current
mailing list