aboutsummaryrefslogtreecommitdiffstats
path: root/consts.c
diff options
context:
space:
mode:
Diffstat (limited to 'consts.c')
-rw-r--r--consts.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/consts.c b/consts.c
new file mode 100644
index 0000000..9a7e3fb
--- /dev/null
+++ b/consts.c
@@ -0,0 +1,16 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+const char *
+get_errno_name(int err)
+{
+ static char buf[3 * sizeof(err) + 2];
+
+#define X(N) if (err == N) return #N;
+ LIST_ERRNOS(X)
+#undef X
+
+ sprintf(buf, "%i", err);
+ return buf;
+}