|
|
1.1 ! root 1: #include <stdio.h> ! 2: #include <string.h> ! 3: ! 4: int ipcerrno; ! 5: char ipcerrstr[256]; ! 6: ! 7: extern int syserrno; ! 8: extern char syserrstr[128]; ! 9: extern int ipcdebug; ! 10: ! 11: extern char *ipclookup(); ! 12: extern ipcgetsyserr(); ! 13: ! 14: /* ! 15: * this routine records errors that the ipc routines themselves ! 16: * have generated. There is no need to check system errno's. ! 17: */ ! 18: ipcseterror(en, em, mess) ! 19: int en; /* the error number - should be from sysexits.h*/ ! 20: char *em; /* the error msg associated with en */ ! 21: char *mess; /* the error label */ ! 22: { ! 23: syserrno = en; ! 24: ipcerrno = en; ! 25: strncpy(syserrstr, em, sizeof(syserrstr)); ! 26: sprintf(ipcerrstr, "%s: %s", mess, syserrstr); ! 27: if (ipcdebug) ! 28: fprintf(stderr, "ipcseterror %d %s %s\n", ! 29: en, em, mess); ! 30: } ! 31: ! 32: /* ! 33: * ipcsyserr determines what system error just occurred, and ! 34: * translates it to the sysexits.h error class. The text is ! 35: * saved for possible posterity. NB: the translation is highly ! 36: * machine-dependent, so each OS needs its own ipclookup routine. ! 37: * ! 38: */ ! 39: ipcsyserr(mess) ! 40: char *mess; ! 41: { ! 42: extern char syserrstr[]; ! 43: ! 44: ipcgetsyserr(); ! 45: ipcerrno = ipcmaperror(); ! 46: sprintf(ipcerrstr, "%s: %s", mess, syserrstr); ! 47: } ! 48: ! 49: ! 50: ipcperror(mess) ! 51: char *mess; ! 52: { ! 53: fprintf(stderr, "%s: %s\n", mess, ipcerrstr); ! 54: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.