|
|
1.1 ! root 1: #include <stdio.h> ! 2: #include <errno.h> ! 3: #include <sysexits.h> ! 4: #include <string.h> ! 5: #include <ipc.h> ! 6: ! 7: /* ! 8: * A known place to keep a copy of the system-supplied ! 9: * error message. ! 10: */ ! 11: int syserrno; ! 12: char syserrstr[128]; ! 13: ! 14: int ipcdebug = 0; ! 15: int ipcerrno = 0; ! 16: ! 17: extern char *ipcpath(); /* make sure these are loaded in */ ! 18: extern int ipcopen(); ! 19: ! 20: ! 21: /* ! 22: * globals for ipc ! 23: */ ! 24: ipcperror(mess) ! 25: char *mess; ! 26: { ! 27: syserrno = errno; ! 28: strcpy(syserrstr, errstr); ! 29: ipcerrno = ipcmaperror(); ! 30: fprintf(stderr, "%s: %s\n", mess, syserrstr); ! 31: } ! 32: ! 33: call() ! 34: { ! 35: ipcpath(); ipcopen(); ! 36: } ! 37: ! 38: /* ! 39: * map the system error in syserrno into one of the ! 40: * errors in sysexits.h ! 41: */ ! 42: int ! 43: ipcmaperror() ! 44: { ! 45: switch (syserrno) { ! 46: case ENOENT: return EX_NOHOST; ! 47: case EINTR: return EX_TEMPFAIL; ! 48: case EACCES: return EX_UNAVAILABLE; ! 49: case ENODEV: return EX_TEMPFAIL; ! 50: case EIO: return EX_TEMPFAIL; ! 51: ! 52: default: return EX_OSERR; ! 53: } ! 54: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.