errno.3am man page

errno — 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.

Referenced By

ares_set_socket_functions(3), efi_get_variable(3), errno(1), error(3), form.3x(3), form_cursor.3x(3), form_driver.3x(3), form_field.3x(3), form_field_attributes.3x(3), form_field_buffer.3x(3), form_field_info.3x(3), form_field_just.3x(3), form_field_opts.3x(3), form_fieldtype.3x(3), form_field_validation.3x(3), form_hook.3x(3), form_opts.3x(3), form_page.3x(3), form_post.3x(3), form_win.3x(3), gawk(1), intro(2), intro(3), ldap_dup(3), ldap_get_dn(3), ldap_init(3), libnbd(3), libnbd-release-notes-1.2(1), lwres_net_ntop(3), math_error(7), menu.3x(3), menu_attributes.3x(3), menu_cursor.3x(3), menu_driver.3x(3), menu_format.3x(3), menu_hook.3x(3), menu_items.3x(3), menu_mark.3x(3), menu_new.3x(3), menu_opts.3x(3), menu_pattern.3x(3), menu_post.3x(3), menu_win.3x(3), mitem_current.3x(3), mitem_new.3x(3), mitem_opts.3x(3), mitem_value.3x(3), perror(3), rc_service(3), sd_bus_error(3), sd_bus_error_add_map(3), sd-bus-errors(3), sd_bus_message_new_method_error(3), sd_journal_print(3), strerror(3), _syscall(2), syscall(2), syscalls(2), systemd.exec(5), systemd.journal-fields(7), zip_error_init(3), zshparam(1).

Jan 15 2013 Free Software Foundation GNU Awk Extension Modules