HomeFreeBSD

strfmon: Fix an edge case when sep_by_space is 2

Description

strfmon: Fix an edge case when sep_by_space is 2

Fix an edge case by printing the required space when, the currency
symbol succeeds the value, a space separates the sign from the value and
the sign position precedes the quantity and the currency symbol.

In other words:

n_cs_precedes = 0
n_sep_by_space = 2
n_sign_posn = 1

From The Open Group's localeconv[1]:

When {p,n,int_p,int_n}_sep_by_space is 2:
If the currency symbol and sign string are adjacent, a space separates
them; otherwise, a space separates the sign string from the value.

Format    Before        After
[%n]      [-123.45¤]    [- 123.45¤]

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/localeconv.html

Obtained from: Darwin
Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

Details

Provenance
jlduran_gmail.comAuthored on Oct 18 2022, 2:24 AM
kibCommitted on Oct 25 2022, 9:40 PM
Parents
rG947efadc3d6e: strfmon: Fix alignment when enclosed by parentheses
Branches
Unknown
Tags
Unknown