Annotation of coherent/b/lib/libc/string/strerror.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * strerror.c
                      3:  * ANSI 4.11.6.2.
                      4:  * String error function.
                      5:  * Assumes COHERENT <errno.h>.
                      6:  * Assumes exactly one of COHERENT, GEMDOS or MSDOS defined.
                      7:  */
                      8: 
                      9: #include <errno.h>
                     10: 
                     11: #ifdef COHERENT
                     12: static char *_errors[] = {
                     13:        "Illegal error number",                 /* 0            */
                     14:        "Not super user",                       /* EPERM        */
                     15:        "No such file or directory",            /* ENOENT       */
                     16:        "Process not found",                    /* ESRCH        */
                     17:        "Interrupted system call",              /* EINTR        */
                     18:        "I/O error",                            /* EIO          */
                     19:        "No such device or address",            /* ENXIO        */
                     20:        "Argument list too long",               /* E2BIG        */
                     21:        "Sys exec format error",                /* ENOEXEC      */
                     22:        "Bad file number",                      /* EBADF        */
                     23:        "No children (wait)",                   /* ECHILD       */
                     24:        "No more processes are available",      /* EAGAIN       */
                     25:        "Cannot map process into memory",       /* ENOMEM       */
                     26:        "Permission denied",                    /* EACCES       */
                     27:        "Bad system call argument address",     /* EFAULT       */
                     28:        "Block device required (mount)",        /* ENOTBLK      */
                     29:        "Device busy",                          /* EBUSY        */
                     30:        "File already exists",                  /* EEXIST       */
                     31:        "Cross device link",                    /* EXDEV        */
                     32:        "No such device",                       /* ENODEV       */
                     33:        "Not a directory",                      /* ENOTDIR      */
                     34:        "Is a directory",                       /* EISDIR       */
                     35:        "Invalid argument",                     /* EINVAL       */
                     36:        "File table overflow",                  /* ENFILE       */
                     37:        "Too many open files for this process", /* EMFILE       */
                     38:        "Not a terminal",                       /* ENOTTY       */
                     39:        "Text file busy",                       /* ETXTBSY      */
                     40:        "File too big to map",                  /* EFBIG        */
                     41:        "No space left on device",              /* ENOSPC       */
                     42:        "Illegal seek on a pipe",               /* ESPIPE       */
                     43:        "Read only filesystem",                 /* EROFS        */
                     44:        "Too many links",                       /* EMLINK       */
                     45:        "Broken pipe",                          /* EPIPE        */
                     46:        "Domain error",                         /* EDOM         */
                     47:        "Result too large",                     /* ERANGE       */
                     48:        "Out of kernel space",                  /* EKSPACE      */
                     49: #if    _I386
                     50:        "Identifier removed",                   /* EIDRM        */
                     51: #else
                     52:        "Driver not loaded",                    /* ENOLOAD      */
                     53: #endif
                     54:        "Bad format",                           /* EBADFMT      */
                     55:        "Device needs attention",               /* EDATTN       */
                     56:        "Device busy",                          /* EDBUSY       */
                     57:        "Deadlock",                             /* EDEADLK      */
                     58:        "No lock available"                     /* ENOLCK       */
                     59: };
                     60: #endif
                     61: 
                     62: #ifdef GEMDOS
                     63: extern char *sys_errlist[];
                     64: extern int sys_nerr;
                     65: #endif
                     66: 
                     67: char *strerror(errnum) int errnum;
                     68: {
                     69: 
                     70: #ifdef COHERENT
                     71:        if (errnum < 0 || errnum > sizeof(_errors)/sizeof(char *))
                     72:                errnum = 0;
                     73:        return _errors[errnum];
                     74: #endif
                     75: 
                     76: #ifdef GEMDOS
                     77:        if (errnum < 0 || errnum > sys_nerr)
                     78:                errnum = 0;
                     79:        return sys_errlist[errnum];
                     80: #endif
                     81: 
                     82: #ifdef MSDOS
                     83:        return (  (errnum == EDOM)   ?  "Domain error"
                     84:                : (errnum == ERANGE) ?  "Result too large"
                     85:                :                       "Illegal error number"
                     86:        );
                     87: #endif
                     88: 
                     89: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.