Re: [PATCH] printf.3: rework '

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

 



Hi наб,

On Fri, Jun 28, 2024 at 05:26:10PM GMT, наб wrote:
> 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

This line would be unchanged except for the trailing text you added.
Please add it in a separate line, so that the patch is (slightly)
smaller (semantic newlines).  If you were writing the text from scratch,
I wouldn't mind these words after the comma, but for modifying existing
text, I'll be a little bit stricter.

> +.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.\&

Please use expanded words; not abbreviations.  I don't know what Cf.
means.  For the commit message, it's fine, but for the page contents
not so much.  See man-pages(7):

$ MANWIDTH=72 man man-pages | sed -n '/Use of e.g./,+10p';
   Use of e.g., i.e., etc., a.k.a., and similar
     In  general,  the  use  of  abbreviations  such as "e.g.", "i.e.",
     "etc.", "cf.", and "a.k.a." should be avoided, in favor  of  suit‐
     able  full  wordings ("for example", "that is", "and so on", "com‐
     pare to", "also known as").

     The only place where such abbreviations may be  acceptable  is  in
     short parenthetical asides (e.g., like this one).

     Always  include  periods in such abbreviations, as shown here.  In
     addition, "e.g." and "i.e." should always be followed by a comma.

> +.BR locale (7)
> +.I grouping
> +and
> +.IR thousands_sep ,
> +contrast with
> +.IR mon_grouping / mon_thousands_sep ,

Hmmm, struct lconv is documented in lconv(3type), but that page is
missing details that are available in locale(7).  Maybe we should move
some text from there to lconv(3type).

> +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].

.IR \[aq] .

Cheers,
Alex

> +.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



-- 
<https://www.alejandro-colomar.es/>

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