Annotation of coherent/d/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 (mount)",                  /* 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:        "Driver not loaded",                    /* ENOLOAD      */
                     50:        "Bad format",                           /* EBADFMT      */
                     51:        "Device needs attention",               /* EDATTN       */
                     52:        "Device busy"                           /* EDBUSY       */
                     53: };
                     54: #endif
                     55: 
                     56: #ifdef GEMDOS
                     57: extern char *sys_errlist[];
                     58: extern int sys_nerr;
                     59: #endif
                     60: 
                     61: char *strerror(errnum) int errnum;
                     62: {
                     63: 
                     64: #ifdef COHERENT
                     65:        if (errnum < 0 || errnum > sizeof(_errors)/sizeof(char *))
                     66:                errnum = 0;
                     67:        return _errors[errnum];
                     68: #endif
                     69: 
                     70: #ifdef GEMDOS
                     71:        if (errnum < 0 || errnum > sys_nerr)
                     72:                errnum = 0;
                     73:        return sys_errlist[errnum];
                     74: #endif
                     75: 
                     76: #ifdef MSDOS
                     77:        return (  (errnum == EDOM)   ?  "Domain error"
                     78:                : (errnum == ERANGE) ?  "Result too large"
                     79:                :                       "Illegal error number"
                     80:        );
                     81: #endif
                     82: 
                     83: }

unix.superglobalmegacorp.com

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