fxlibc/src/libc/string/strerror.c

16 lines
424 B
C

#include <string.h>
#include <errno.h>
static char *errno_strings [] = {
[0] = "Success",
[EDOM] = "Numerical argument out of domain",
[EILSEQ] = "Invalid or incomplete multibyte or wide character",
[ERANGE] = "Numerical result out of range",
};
char *strerror(int e)
{
int count = sizeof errno_strings / sizeof errno_strings[0];
return (e >= 0 && e < count) ? errno_strings[e] : "<Unknown errno>";
}