diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-12-23 15:01:07 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-12-23 15:02:50 +0100 |
commit | 9702a7901e18460e8ffc5f56a493d41294a8e936 (patch) | |
tree | 0e7147c9c7e3d4cb14d3474c9dd947dcf64b38a9 /manual | |
parent | cd0c333d2ea82d0ae14719bdbef86d99615bdb00 (diff) | |
download | glibc-9702a7901e18460e8ffc5f56a493d41294a8e936.tar.gz glibc-9702a7901e18460e8ffc5f56a493d41294a8e936.tar.xz glibc-9702a7901e18460e8ffc5f56a493d41294a8e936.zip |
stdio: Implement %#m for vfprintf and related functions
%#m prints errno as an error constant if one is available, or a decimal number as a fallback. This intends to address the gap that strerrorname_np does not work well with printf for unknown error codes due to its NULL return values in those cases. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'manual')
-rw-r--r-- | manual/stdio.texi | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/manual/stdio.texi b/manual/stdio.texi index 29d01b9ec9..1fac8e5f78 100644 --- a/manual/stdio.texi +++ b/manual/stdio.texi @@ -1949,6 +1949,9 @@ which can be parsed by the @code{strtoul} function (@pxref{Parsing of Integers}) and @code{scanf} with the @samp{%i} conversion (@pxref{Numeric Input Conversions}). +For the @samp{%m} conversion, print an error constant or decimal error +number, instead of a (possibly translated) error message. + @item @samp{'} Separate the digits into groups as specified by the locale specified for the @code{LC_NUMERIC} category; @pxref{General Numeric}. This flag is a @@ -2271,8 +2274,9 @@ is equivalent to: fprintf (stderr, "can't open `%s': %s\n", filename, strerror (errno)); @end smallexample -@noindent -The @samp{%m} conversion is a @glibcadj{} extension. +The @samp{%m} conversion can be used with the @samp{#} flag to print an +error constant, as provided by @code{strerrorname_np}. Both @samp{%m} +and @samp{%#m} are @glibcadj{} extensions. The @samp{%p} conversion prints a pointer value. The corresponding argument must be of type @code{void *}. In practice, you can use any |