]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
strfmon: Fix alignment when enclosed by parentheses
authorJose Luis Duran <jlduran@gmail.com>
Fri, 14 Oct 2022 23:26:32 +0000 (20:26 -0300)
committerKonstantin Belousov <kib@FreeBSD.org>
Tue, 25 Oct 2022 21:40:17 +0000 (00:40 +0300)
commit947efadc3d6e778a824618d82f53f061bec69b77
treec9958dfc8f268312e84042401a26b9c022a7c7b3
parent6da51e19e347c13e133bcba68cc6100c16320a01
strfmon: Fix alignment when enclosed by parentheses

Take into consideration the possibility of quantities enclosed by
parentheses when aligning.

Matches the examples from The Open Group's:

Format  Before          After
%(#5n   [$   123.45]    [ $   123.45 ]  Use an alternative pos/neg style
        [($   123.45)]  [($   123.45)]
        [$ 3,456.78]    [ $ 3,456.78 ]

%!(#5n  [   123.45]     [    123.45 ]   Disable the currency symbol
        [(   123.45)]   [(   123.45)]
        [ 3,456.78]     [  3,456.78 ]

https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon.html

SD5-XSH-ERN-29 is applied, updating the examples for %(#5n and %!(#5n.

Obtained from: Darwin
Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week
lib/libc/stdlib/strfmon.c
lib/libc/tests/stdlib/strfmon_test.c