[PATCH] printf.3: rework '

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As it stands, this is worse than useless
(defined as: I had to test it explicitly against strfmon() and look at
             POSIX myself to make sure the manual wasn't lying to me
 https://101010.pl/@nabijaczleweli/112694726416515899):

No-one cares if some compiler doesn't understand something from 1994.
(Careful readers will note it's been 30 years.)

"SUSv2 doesn't have this, SUSv3" does is reefer-induced:
this figures in SUSv1 (XPG Issue 4 Version 2)
and the CHANGE HISTORY clearly notes ' was added in i4, not i4v2.

It's important that these aren't actually grouped by the thousand,
but, instead, by "what the locale says".

Each locale has two groupings: monetary and non-monetary,
and it's paramount to indicate which is which
(hi_IN is 3,2... monetary and 3... non-monetary;
 mjw_IN is 3,2... both).

It waxes poetic for way too long about "how to set a locale".

Also replace "The Single UNIX Specification adds" with "POSIX adds".
The SUS is, on a good day, a profile of POSIX you pay 300$ for.
Maybe you could swing this back when it was an "extension"
(so, only required in the SUS profile)
but it's just shaded CX ("this is intentionally different from C")
in Issue 8. It's really irrelevant here.

Also add this to HISTORY
(and call it something sane there;
 the Proper nomenclature is absolutely meaningless to normal people).
The most important bit for every HISTORY reader is the 1994 date.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx>
---
 man/man3/printf.3 | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/man/man3/printf.3 b/man/man3/printf.3
index 54a0339..6f6c952 100644
--- a/man/man3/printf.3
+++ b/man/man3/printf.3
@@ -361,7 +361,7 @@ .SS Flag characters
 overrides a space if both are used.
 .P
 The five flag characters above are defined in the C99 standard.
-The Single UNIX Specification specifies one further flag character.
+POSIX specifies one further flag character.
 .TP
 .B \[aq]
 For decimal conversion
@@ -372,20 +372,21 @@ .SS Flag characters
 .BR F ,
 .BR g ,
 .BR G )
-the output is to be grouped with thousands' grouping characters
-if the locale information indicates any.
-(See
-.BR setlocale (3).)
-Note that many versions of
-.BR gcc (1)
-cannot parse this option and will issue a warning.
-(SUSv2 did not
-include \fI%\[aq]F\fP, but SUSv3 added it.)
-Note also that the default locale of a C program is "C"
-whose locale information indicates no thousands' grouping character.
-Therefore, without a prior call to
-.BR setlocale (3),
-no thousands' grouping characters will be printed.
+the output is to be grouped with thousands' grouping characters, as a
+.I non-monetary
+quantity.
+Misleadingly, this isn't necessarily every thousand:
+for example Karbi ("mjw_IN"), groups its digits into 3 once, then 2 repeatedly.
+Cf.\&
+.BR locale (7)
+.I grouping
+and
+.IR thousands_sep ,
+contrast with
+.IR mon_grouping / mon_thousands_sep ,
+and
+.BR strfmon (3).
+This is a no-op in the default "C" locale.
 .P
 glibc 2.2 adds one further flag character.
 .TP
@@ -980,6 +981,8 @@ .SH HISTORY
 .BR vdprintf ()
 GNU, POSIX.1-2008.
 .P
+Issue 4 of the X/Open Portability Guide (SUSv1, 1994) adds \[aq].
+.P
 .\" Linux libc4 knows about the five C standard flags.
 .\" It knows about the length modifiers \fBh\fP, \fBl\fP, \fBL\fP,
 .\" and the conversions
-- 
2.39.2

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux