source: bootcd/isolinux/syslinux-6.03/com32/lib/strerror.c

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 539 bytes
Line 
1/*
2 * strerror.c
3 */
4
5#include <string.h>
6
7char *strerror(int errnum)
8{
9        static char message[32] = "error ";     /* enough for error 2^63-1 */
10        char numbuf[32];
11        char *p;
12        unsigned int e = (unsigned int)errnum;
13
14        extern const int sys_nerr;
15        extern const char *const sys_errlist[];
16
17        if (e < (unsigned int)sys_nerr && sys_errlist[e])
18                return (char *)sys_errlist[e];
19
20        p = numbuf + sizeof numbuf;
21        *--p = '\0';
22
23        do {
24                *--p = (e % 10) + '0';
25                e /= 10;
26        } while (e);
27
28        memcpy(message + 6, p, (numbuf + sizeof numbuf) - p);
29
30        return message;
31}
Note: See TracBrowser for help on using the repository browser.