Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Nov 2015 04:50:54 +0300
From:      Andrey Chernov <ache@freebsd.org>
To:        Baptiste Daroussin <bapt@freebsd.org>
Cc:        Ed Schouten <ed@nuxi.nl>, Jilles Tjoelker <jilles@stack.nl>, "Sergey V. Dyatko" <sergey.dyatko@gmail.com>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: /bin/ls formatting broken for non-C(?) locales
Message-ID:  <565513FE.4060809@freebsd.org>
In-Reply-To: <56550F69.8050609@freebsd.org>
References:  <20151120110556.6e20a71f@laptop.minsk.domain> <20151120104253.GA21071@ivaldir.etoilebsd.net> <20151120110212.GB21071@ivaldir.etoilebsd.net> <20151120122352.GA5751@stack.nl> <20151121003541.GF21071@ivaldir.etoilebsd.net> <CABh_MK=cz-zB7krcnKjhqfW9VnwjSmuaZ9%2BAETQiLy3AsHq_vw@mail.gmail.com> <5650DACA.2090501@freebsd.org> <20151125001513.GC70014@ivaldir.etoilebsd.net> <56550F69.8050609@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--F4w0U9dvjAtFfoL3PNrL61l4Av2dJkS2X
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 25.11.2015 4:31, Andrey Chernov wrote:
> 4) The whole processing looks overcomplicated and not effective. What
> about this instead?
> for (i =3D 0; i < 12; i++) {
>     count wcswidth() of each month and store it in wab_months_width[].
>     count max_width_month.
> }
> for (i =3D 0; i < 12; i++) {
>     if ((n =3D 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);

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


--F4w0U9dvjAtFfoL3PNrL61l4Av2dJkS2X
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEcBAEBCAAGBQJWVRP+AAoJEKUckv0MjfbKWpAH/RDPJ2mwJjG7v3O0ZywSeI5o
jZ2RARcPWKZCXKyCsc4uQywOIk8JopsjNDkxJqm7LZPoKXFhHKGKJ0U27o125ZG9
qC2LnheD5kTXEED23giz0HoT6E2saa7Fuw5usq1MYBQjnbOX9izm9kUOUWjwZ14I
g1Zk9TXsGOXkKC/XYHcwpm3U9m2DuiZdTUgvqj+Mayvpe5VUlg7juXQgxozWFFWy
y1+OmGXADjTCoCwiIdtDQPzWecWCT9gVBTHpUabwaRlgJdISxlKf5QjYl54Rr2cE
WyiRhnPRTTH+c3M3Nd5u2PMswp5JoDcaVVcOZojzV7n4yZK3pZ50Vt63AEQ3Rj8=
=QLiZ
-----END PGP SIGNATURE-----

--F4w0U9dvjAtFfoL3PNrL61l4Av2dJkS2X--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?565513FE.4060809>