[Bug 267282] [PATCH] strfmon: Attempt to fix some strfmon(3) bugs

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 25 Oct 2022 21:52:12 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267282

--- Comment #3 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=750fe3e6a4619e040c7b0951775698b61290102e

commit 750fe3e6a4619e040c7b0951775698b61290102e
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-10-18 02:24:03 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-10-25 21:40:17 +0000

    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

 lib/libc/stdlib/strfmon.c            | 8 ++++++--
 lib/libc/tests/stdlib/strfmon_test.c | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.