From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>, Jonny Grant <jg@jguk.org>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: glibc strerrorname_np
Date: Mon, 8 Nov 2021 11:01:28 -0300 [thread overview]
Message-ID: <1464e69a-110a-9551-4a62-79bc63cc8064@linaro.org> (raw)
In-Reply-To: <874k8nniw4.fsf@oldenburg.str.redhat.com>
On 08/11/2021 05:36, Florian Weimer via Libc-alpha wrote:
> * Jonny Grant:
>
>> I noticed on the man page it may return NULL, which is a shame, as then it means we always need to check that before using in every printf etc :-
>>
>> printf("err %s\n", strerrorname_np(myerr)?strerrorname_np(myerr), "Unknown err");
>
> We can add %#m to printf for this use case. It would print the errno
> constant if known, or a number otherwise. To use it, errno needs to be
> assigned before calling printf. Printing multiple error codes would not
> be possible directly, but such usage is quite rare.
>
> On older glibc, it prints the (translated) string, which is better than
> nothing.
>
This is not a fully replacement, but I think is a reasonable extension.
prev parent reply other threads:[~2021-11-08 14:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 20:23 Jonny Grant
2021-11-04 20:46 ` Adhemerval Zanella
2021-11-04 22:52 ` Jonny Grant
2021-11-04 23:28 ` Adhemerval Zanella
2021-11-05 11:51 ` Jonny Grant
2021-11-05 13:01 ` Adhemerval Zanella
2021-11-05 22:23 ` Jonny Grant
2021-11-06 12:51 ` Adhemerval Zanella
2021-11-07 17:37 ` Zack Weinberg
2021-11-08 13:56 ` Adhemerval Zanella
2021-11-08 18:42 ` Zack Weinberg
2021-11-08 18:52 ` Adhemerval Zanella
2021-11-08 19:56 ` Florian Weimer
2021-11-08 20:28 ` Adhemerval Zanella
2021-11-08 22:22 ` Jonny Grant
2021-11-09 12:30 ` Adhemerval Zanella
2021-11-09 23:01 ` Jonny Grant
2021-11-10 1:37 ` Adhemerval Zanella
2021-11-08 8:36 ` Florian Weimer
2021-11-08 13:36 ` Jonny Grant
2021-11-08 13:42 ` Florian Weimer
2021-11-08 22:14 ` Jonny Grant
2021-11-08 14:01 ` Adhemerval Zanella [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464e69a-110a-9551-4a62-79bc63cc8064@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=fweimer@redhat.com \
--cc=jg@jguk.org \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).