diff options
author | ewt <devnull@localhost> | 1997-05-07 15:09:39 +0000 |
---|---|---|
committer | ewt <devnull@localhost> | 1997-05-07 15:09:39 +0000 |
commit | 67c8991eb0560035783f1e44ce6b757c61509ec4 (patch) | |
tree | fb17bb92d682f99cb5157cde99d289e53bfcdcfe /misc | |
parent | 9c2a152c85f5c6b97f25ac4b0b355d6a816fe967 (diff) | |
download | rpm-67c8991eb0560035783f1e44ce6b757c61509ec4.tar.gz rpm-67c8991eb0560035783f1e44ce6b757c61509ec4.tar.bz2 rpm-67c8991eb0560035783f1e44ce6b757c61509ec4.zip |
*** empty log message ***
CVS patchset: 1608
CVS date: 1997/05/07 15:09:39
Diffstat (limited to 'misc')
-rw-r--r-- | misc/strerror.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/misc/strerror.c b/misc/strerror.c new file mode 100644 index 000000000..acb81618c --- /dev/null +++ b/misc/strerror.c @@ -0,0 +1,22 @@ +#include<stdlib.h> +#include<errno.h> +#include<stdio.h> + +extern int sys_nerr; +extern char *sys_errlist[]; +static char buf[64]; +char * strerror(int errnum) + +{ + if (errnum < 0 || errnum > sys_nerr) + { + static char fmt[] = "Unknown error %d"; + size_t len = (size_t) sprintf (buf, fmt, errnum); + if (len < (size_t) sizeof(fmt) - 2) + return NULL; + buf[len - 1] = '\0'; + return buf; + } + + return (char *) sys_errlist[errnum]; +} |