Annotation of researchv10no/cmd/nupas/ipc/s5uts_err.c, revision 1.1

1.1     ! root        1: /* needed for unresolved references (see ../mbox)
        !             2:        from res_err.c & ultrix_err.c ..  wmb */
        !             3: 
        !             4: #include <stdio.h>
        !             5: #include <errno.h>
        !             6: #include <sysexits.h>
        !             7: #include <string.h>
        !             8: 
        !             9: /*
        !            10:  * A known place to keep a copy of the system-supplied
        !            11:  * error message.
        !            12:  */
        !            13: int syserrno;
        !            14: char syserrstr[128];
        !            15: 
        !            16: /*
        !            17:  * map the system error in syserrno into one of the
        !            18:  * errors in sysexits.h
        !            19:  */
        !            20: int
        !            21: ipcmaperror()
        !            22: {
        !            23:        switch (syserrno) {
        !            24:        case ENOENT:    return EX_NOHOST;
        !            25:        case EINTR:     return EX_TEMPFAIL;
        !            26:        case EACCES:    return EX_UNAVAILABLE;
        !            27:        case ENODEV:    return EX_TEMPFAIL;
        !            28:        case EIO:       return EX_TEMPFAIL;
        !            29: 
        !            30:        default:        return EX_OSERR;
        !            31:        }
        !            32: }
        !            33: 
        !            34: 
        !            35: extern char *sys_errlist[ ];
        !            36: extern int sys_nerr;
        !            37: 
        !            38: extern int ipcdebug;
        !            39: 
        !            40: /*
        !            41:  * Copy the actual OS-supplied errno and string in a known
        !            42:  * place.
        !            43:  */
        !            44: ipcgetsyserr()
        !            45: {
        !            46:        syserrno = errno;
        !            47:        if (ipcdebug)
        !            48:                fprintf(stderr, "ipcgetsyserr: errno=%d\n", syserrno);
        !            49:        if (errno < sys_nerr)
        !            50:                strcpy(syserrstr, sys_errlist[errno]);
        !            51:        else
        !            52:                sprintf(syserrstr, "Unknown error number %d", errno);
        !            53: }
        !            54: 
        !            55: /*
        !            56:  * Dummy gethostname (hostname supplied at gateway)
        !            57:  */
        !            58: int
        !            59: gethostname(hostname,namelen)
        !            60: char *hostname;
        !            61: int namelen;
        !            62: {
        !            63:        *hostname = '\0';
        !            64:        return 0;
        !            65: }

unix.superglobalmegacorp.com

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