Skip to contentSkip to conversation

printf.3: Document %#m as strerrorname_np(errno)

PATCH In review Alejandro Colomar 2 participants 3 messages Dec 22, 2021 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 printf.3: Document %#m as strerrorname_np(errno)

---

Hi Adhemerval and Michael,

First of all, happy new solar year! :)

I added documentation for "%#m". Could you confirm I got the glibc version correct, and also have a look at the changes?

Thanks for the report!

Cheers,
Alex

 man3/printf.3 | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
man3/printf.3 +22 -1
index 4fa1f11f3..1e2bac4df 100644
@@ -301,6 +301,17 @@ and
 .B G
 conversions, trailing zeros are not removed from the result as they would
 otherwise be.
+For
+.BR m ,
+if
+.I errno
+contains a valid error code,
+the output of
+.I strerrorname_np(errno)
+is printed;
+otherwise, the value stored in
+.I errno
+is printed as a decimal number.
 For other conversions, the result is undefined.
 .TP
 .B \&0
@@ -853,7 +864,10 @@ any flags, a field width, or a precision.
 .B m
 (Glibc extension; supported by uClibc and musl.)
 Print output of
-.IR strerror(errno) .
+.I strerror(errno)
+(or
+.I strerrorname_np(errno)
+in the alternate form).
 No argument is required.
 .TP
 .B %
@@ -974,6 +988,13 @@ and conversion characters \fBa\fP and \fBA\fP.
 .PP
 glibc 2.2 adds the conversion character \fBF\fP with C99 semantics,
 and the flag character \fBI\fP.
+.PP
+glibc 2.35 gives a meaning to the alternate form
+.RB ( # )
+of the
+.B m
+conversion specifier, that is
+.IR %#m .
 .SH NOTES
 Some programs imprudently rely on code such as the following
 .PP
Signature · 1 line
2.34.1
#1 lore raw
Quoted 46 lines · Alejandro Colomar

---

Hi Adhemerval and Michael,

First of all, happy new solar year! :)

I added documentation for "%#m". Could you confirm I got the glibc version correct, and also have a look at the changes?

Thanks for the report!

Cheers,
Alex

 man3/printf.3 | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
man3/printf.3 +11 -0
index 4fa1f11f3..1e2bac4df 100644
@@ -301,6 +301,17 @@ and
 .B G
 conversions, trailing zeros are not removed from the result as they would
 otherwise be.
+For
+.BR m ,
+if
+.I errno
+contains a valid error code,
+the output of
+.I strerrorname_np(errno)
+is printed;
+otherwise, the value stored in
+.I errno
+is printed as a decimal number.
 For other conversions, the result is undefined.
 .TP
 .B \&0
@@ -853,7 +864,10 @@ any flags, a field width, or a precision.
 .B m

man3/printf.3 any flags, a field width, or a precision. · line 873

Quoted 10 lines
man3/printf.3 +4 -1
 (Glibc extension; supported by uClibc and musl.)
 Print output of
-.IR strerror(errno) .
+.I strerror(errno)
+(or
+.I strerrorname_np(errno)
+in the alternate form).
 No argument is required.
 .TP
 .B %

Maybe add that strerrorname_np is only support on glibc, since on the same section it states that 'm' is a Glibc extension supported by uClibc and musl.

The rest look ok, thanks.

Quoted 14 lines
man3/printf.3 +7 -0
@@ -974,6 +988,13 @@ and conversion characters \fBa\fP and \fBA\fP.
 .PP
 glibc 2.2 adds the conversion character \fBF\fP with C99 semantics,
 and the flag character \fBI\fP.
+.PP
+glibc 2.35 gives a meaning to the alternate form
+.RB ( # )
+of the
+.B m
+conversion specifier, that is
+.IR %#m .
 .SH NOTES
 Some programs imprudently rely on code such as the following
 .PP
#2 lore raw
Quoted 8 lines · Adhemerval Zanella
Quoted 8 lines
man3/printf.3 +3 -1
@@ -853,7 +864,10 @@ any flags, a field width, or a precision.
  .B m
  (Glibc extension; supported by uClibc and musl.)
  Print output of
-.IR strerror(errno) .
+.I strerror(errno)
+(or
+.I strerrorname_np(errno)
Quoted 8 lines

man3/printf.3 any flags, a field width, or a precision. · line 873

Quoted 4 lines
man3/printf.3 +1 -0
+in the alternate form).
  No argument is required.
  .TP
  .B %

Maybe add that strerrorname_np is only support on glibc, since on the same section it states that 'm' is a Glibc extension supported by uClibc and musl.

This is the main documentation for %m in the man pages, and it differs from the printf(3) CONFORMING TO (C89 and POSIX.1-2001). However, there's only a mention to strerrorname_np(3), whose main (man-pages) documentation is in strerror(3), and there it's already noted that it's a glibc extension, so I think that's enough.

Quoted 2 lines

The rest look ok, thanks.

Thank you :)

Cheers,
Alex

Signature · 2 lines
Alejandro Colomar
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/