Thread (1 message) 1 message, 1 author, 2012-05-08

Re: Is there a way to get "EINVAL" style string

From: Jon Grant <hidden>
Date: 2012-05-08 21:33:45

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[off-list ref]  wrote:
quoted
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?
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help