diff options
Diffstat (limited to 'src/string/strerror.c')
-rw-r--r-- | src/string/strerror.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/string/strerror.c b/src/string/strerror.c new file mode 100644 index 00000000..055a11f7 --- /dev/null +++ b/src/string/strerror.c @@ -0,0 +1,31 @@ +#include <string.h> +#include "errno.h" +#include "stdio.h" +# define __LONGEST_STRERR 64 /* FIXME */ + +/** convert error number to string **/ +char * strerror(int errnum) +{ + static char errstr[__LONGEST_STRERR+1]; + + switch (errnum) { + #include "_strerror.h" + default: + sprintf(errstr, "unknown error [%d]", errnum); + break; + } + + /* + RETURN_ALWAYS(a pointer to the message string); + */ + return errstr; +} + +/*** +converts the error number ARGUMENT(errnum) to an error message +string. The string returned should not be modified, and may be overwritten by +subsequent calls. +***/ +/* +STDC(1) +*/ |