about summary refs log tree commit diff
path: root/stdio-common/errlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/errlist.c')
-rw-r--r--stdio-common/errlist.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/stdio-common/errlist.c b/stdio-common/errlist.c
index 91fa789be0..df52356066 100644
--- a/stdio-common/errlist.c
+++ b/stdio-common/errlist.c
@@ -15,22 +15,24 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <stdio.h>
+#include <errno.h>
+#include <libintl.h>
 #include <array_length.h>
-#include <stddef.h>
 
-const char *const _sys_errlist[] =
+const char *const _sys_errlist_internal[] =
   {
-    "Error 0",			/* 0 */
-    "Argument out of function's domain", /* 1 = EDOM */
-    "Result out of range",	/* 2 = ERANGE */
-    "Operation not implemented", /* 3 = ENOSYS */
-    "Invalid argument",		/* 4 = EINVAL */
-    "Illegal seek",		/* 5 = ESPIPE */
-    "Bad file descriptor",	/* 6 = EBADF */
-    "Cannot allocate memory",	/* 7 = ENOMEM */
-    "Permission denied",	/* 8 = EACCES */
-    "Too many open files in system", /* 9 = ENFILE */
-    "Too many open files",	/* 10 = EMFILE */
+#define _S(n, str)         [n] = str,
+#include <errlist.h>
+#undef _S
   };
 
-const int _sys_nerr = array_length (_sys_errlist);
+const char *
+__get_errlist (int errnum)
+{
+  if (errnum >= 0 && errnum < array_length (_sys_errlist_internal))
+    return _sys_errlist_internal[errnum];
+  return NULL;
+}
+
+#include <errlist-compat.c>