All of lore.kernel.org
 help / color / mirror / Atom feed
* Is there a way to get "EINVAL" style string
@ 2012-04-22 11:14 Jon Grant
       [not found] ` <4F93E7FC.1020904-hus3n9K41k0@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Grant @ 2012-04-22 11:14 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Hello

I was looking at the man pages looking for a way to get a string of the 
errno value meaning. This is kind of a user question.

This API returns "returns a pointer to a string that describes the error 
code":

http://man7.org/linux/man-pages/man3/strerror.3.html

However, this is a description, e.g. "Invalid argument".  Is there a 
function that would return "EINVAL" or "ENOENT" as the string?

Could I suggest that the text on the man page be updated to clarify what 
would be returned:

"returns a pointer to a string that describes the error code. e.g. 
"Invalid argument" if EINVAL was the errnum."

Best regards, Jon
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is there a way to get "EINVAL" style string
       [not found] ` <4F93E7FC.1020904-hus3n9K41k0@public.gmane.org>
@ 2012-04-22 21:25   ` Michael Kerrisk (man-pages)
       [not found]     ` <CAKgNAkjP-SZXceGDaBeuNE9onk_w9-8rX1uk-XE2dRu5x8uz_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2012-04-22 21:25 UTC (permalink / raw)
  To: Jon Grant; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Hi Jon,

On Sun, Apr 22, 2012 at 11:14 PM, Jon Grant <jg-hus3n9K41k0@public.gmane.org> wrote:
> Hello
>
> I was looking at the man pages looking for a way to get a string of the
> errno value meaning. This is kind of a user question.
>
> This API returns "returns a pointer to a string that describes the error
> code":
>
> http://man7.org/linux/man-pages/man3/strerror.3.html
>
> However, this is a description, e.g. "Invalid argument".  Is there a
> function that would return "EINVAL" or "ENOENT" as the string?

None that I know of. (In passing, I dealt with exactly this problem
for my book with a script that generated the string names; see
http://man7.org/tlpi/code/online/dist/lib/ename.c.inc.html and
http://man7.org/tlpi/code/online/dist/lib/error_functions.c.html)

> Could I suggest that the text on the man page be updated to clarify what
> would be returned:
>
> "returns a pointer to a string that describes the error code. e.g. "Invalid
> argument" if EINVAL was the errnum."

Done for 3.40.

Cheers,

Michael



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is there a way to get "EINVAL" style string
       [not found]     ` <CAKgNAkjP-SZXceGDaBeuNE9onk_w9-8rX1uk-XE2dRu5x8uz_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-05-08 21:33       ` Jon Grant
       [not found]         ` <4FA99139.90102-hus3n9K41k0@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Grant @ 2012-05-08 21:33 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Hi Michael

On 22/04/12 22:25, Michael Kerrisk (man-pages) wrote:
> Hi Jon,
>
> On Sun, Apr 22, 2012 at 11:14 PM, Jon Grant<jg-hus3n9K41k0@public.gmane.org>  wrote:
>> Hello
>>
>> I was looking at the man pages looking for a way to get a string of the
>> errno value meaning. This is kind of a user question.
>>
>> This API returns "returns a pointer to a string that describes the error
>> code":
>>
>> http://man7.org/linux/man-pages/man3/strerror.3.html
>>
>> However, this is a description, e.g. "Invalid argument".  Is there a
>> function that would return "EINVAL" or "ENOENT" as the string?
>
> None that I know of. (In passing, I dealt with exactly this problem
> for my book with a script that generated the string names; see
> http://man7.org/tlpi/code/online/dist/lib/ename.c.inc.html and
> http://man7.org/tlpi/code/online/dist/lib/error_functions.c.html)

Interesting. I saw on the ename.c page that the numbers were in the 
table hard coded -- is it guaranteed that 90 will always correspond to 
EPROTOTYPE on a unixy system?

>> Could I suggest that the text on the man page be updated to clarify what
>> would be returned:
>>
>> "returns a pointer to a string that describes the error code. e.g. "Invalid
>> argument" if EINVAL was the errnum."
>
> Done for 3.40.

Great, thank you!
Jon
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is there a way to get "EINVAL" style string
       [not found]         ` <4FA99139.90102-hus3n9K41k0@public.gmane.org>
@ 2012-05-08 22:30           ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2012-05-08 22:30 UTC (permalink / raw)
  To: Jon Grant; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Hi Jon,

>>> I was looking at the man pages looking for a way to get a string of the
>>> errno value meaning. This is kind of a user question.
>>>
>>> This API returns "returns a pointer to a string that describes the error
>>> code":
>>>
>>> http://man7.org/linux/man-pages/man3/strerror.3.html
>>>
>>> However, this is a description, e.g. "Invalid argument".  Is there a
>>> function that would return "EINVAL" or "ENOENT" as the string?
>>
>>
>> None that I know of. (In passing, I dealt with exactly this problem
>> for my book with a script that generated the string names; see
>> http://man7.org/tlpi/code/online/dist/lib/ename.c.inc.html and
>> http://man7.org/tlpi/code/online/dist/lib/error_functions.c.html)
>
>
> Interesting. I saw on the ename.c page that the numbers were in the table
> hard coded -- is it guaranteed that 90 will always correspond to EPROTOTYPE
> on a unixy system?

No. So, my build code deals with this by using a script to build a
platform-specific ename.c.inc file (have a look at the tarball.)

Thanks,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-08 22:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-22 11:14 Is there a way to get "EINVAL" style string Jon Grant
     [not found] ` <4F93E7FC.1020904-hus3n9K41k0@public.gmane.org>
2012-04-22 21:25   ` Michael Kerrisk (man-pages)
     [not found]     ` <CAKgNAkjP-SZXceGDaBeuNE9onk_w9-8rX1uk-XE2dRu5x8uz_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-08 21:33       ` Jon Grant
     [not found]         ` <4FA99139.90102-hus3n9K41k0@public.gmane.org>
2012-05-08 22:30           ` Michael Kerrisk (man-pages)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.