errorname is a [[BSD-0]] licensed error message library written in [[3. Reference/Software/Programming Languages/C|C]].
- [Source](https://github.com/mentalisttraceur/errnoname)
> `errnoname` is a C library that lets us get the symbolic name for each `errno` integer value.
# Notability
A useful reference for `errno` values so that I don't have to look them up myself.
The `gather-errno-names.sh` file contains URLs and Git repo links to the source files or documentation and automatically extracts the latest `errnos`. Another fantastic resource.
# Philosophy
Fundamentally the contents are dirt simple. All the work is collecting and maintaining the lists.
It comes in two flavors:
- Bigass array
- Bigass case statement
Each `errno` entry/branch is wrapped in a check to see if that constant is defined.
# OS Support
Nearly every [[Unix]]-like OS ever made as well as a couple others.
- [[Linux]]
- [[Haiku]]
- [[Redox OS]]
- [[FreeBSD]]
- [[OpenBSD]]
- [[NetBSD]]
- [[DragonFly BSD]]
- [[Illumos]]
- [[OpenSolaris]]
- [[Solaris]]
- [[Darwin]]
- [[Irix]]
- [[Hurd]]
- [[QNX]]
- [[Minix]]
- [[HP-UX]]
- [[ULTRIX]]
- [[Tru64]]
- [[OpenServer]]
- [[UnixWare]]
- [[AIX]]
- [[z/OS]]
I can't find anything mentioning Windows, but the dev did mention wanting to support it at some point. Not sure how `errno` is used on that platform.
# Features
The only thing this does is see which `errno` constants are available and then return the name of the constant so that it is much easier to tell what went wrong when a system library returns an error via `errono`.
# Alternatives
GNU's libc provides a `strerrordesc_np` procedure which does something similar.
# References
- https://stackoverflow.com/questions/19885360/how-can-i-print-the-symbolic-name-of-an-errno-in-c
- https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html
- https://man7.org/linux/man-pages/man3/strerrorname_np.3.html