ERRNO(3am)
β¨ errno β ok bestie, this is the gawk extension that turns errno values into strings and back π
so like. this page lives in the GNU Awk Extension Modules corner of the manual-verse, section 3am, and it's genuinely one of the most useful little guys you'll ever @load. no cap.
πΈ NAME πΈ
errno β the gawk extension that converts errno values to strings and vice versa. it's giving translator. it's giving bilingual icon. π¦
π SYNOPSIS π
@load "errno"
string = strerror(11)
string = errno2name(11)
integer = name2errno("EAGAIN")
like yes, that's the whole vibe. three functions, one load. slay. β¨
π DESCRIPTION π
okay so here's the tea: this extension is for working with the gawk PROCINFO["errno"] value. that's its whole main character purpose. π«Ά
and the way it does that is by adding three functions, named strerror(), errno2name(), and name2errno(). let's go one by one, bestie:
strerror()β this one takes an integer argument and hands you back the result of calling thestrerror(3)C library function. that's it, that's the whole job. but β and this is important β if the argument is not numeric, it returns an empty string. so don't come at it with vibes, come at it with numbers. πerrno2name()β this one takes an integer argument and returns the symbolic name for the associated errno value. like, for example, the returned value might be"EACCES"or"EAGAIN". and if the argument is something it doesn't recognize? empty string. nothing. silence. πname2errno()β the reverse baddie. 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 be11. and for unrecognized arguments, it returns a value of-1. iconic behavior, honestly. π
π EXAMPLE π
here's what it looks like in the wild, fr fr:
@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)
not me tearing up at how clean that is. π₯Ή
π SEE ALSO π
go read that one too, it's the OG. iykyk. π
π AUTHOR π
Andrew Schorr β thank you for your service, king. π
π§ COPYING PERMISSIONS π§
okay legal bestie moment, don't skip this part:
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.
β¨ and that's the whole page, bestie. go forth and @load "errno" responsibly. π«Ά
this lil masterpiece comes to you courtesy of the Free Software Foundation, dated Jan 15 2013, and it lives at ERRNO(3am) forever and ever. mwah. π
π¦ where this page comes from
- fedora 43: gawk-errno 1.1.1-7.fc43 Β· GPL-3.0-or-later
- fedora 44: gawk-errno 1.1.1-8.fc44 Β· GPL-3.0-or-later
- nixos 26.05: gawkextlib-errno-unstable 2022-10-20
- nixpkgs unstable: gawkextlib-errno-unstable 2022-10-20
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms