ERRNO

NAME
SYNOPSIS
DESCRIPTION
EXAMPLE
SEE ALSO
AUTHOR
COPYING PERMISSIONS

NAME

errno − gawk extension to convert errno values to strings and vice versa

SYNOPSIS

@load "errno"

string = strerror(11)
string = errno2name(11)
integer = name2errno("EAGAIN")

DESCRIPTION

This extension is useful for working with the gawk PROCINFO["errno"] value. The errno extension adds three functions named strerror(), errno2name(), and name2errno(), as follows:
strerror()

This function takes an integer argument and returns the result from calling the strerror(3) C library function. If the argument is not numeric, it will return an empty string.

errno2name()

This function takes an integer argument and returns the symbolic name for the associated errno value. For example, the returned value might be "EACCES" or "EAGAIN". An empty string is returned for an unrecognized argument.

name2errno()

This function takes a string argument and returns the integer value associated with that symbolic errno value. For example, if the argument is "EAGAIN", the returned value might be 11. For unrecognized arguments, a value of -1 is returned.

EXAMPLE

@load "errno"
...
printf "The numeric value of ’EAGAIN’ is %d\n", name2errno("EAGAIN")
printf "The string value of 11 is %s\n", errno2name(11)
printf "The description of errno 11 is ’%s’\n", strerror(11)

SEE ALSO

strerror(3)

AUTHOR

Andrew Schorr

COPYING PERMISSIONS

Copyright © 2012, 2013, Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies of this manual page provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual page under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.