|
|
1.1 ! root 1: # include <stdio.h> ! 2: # include <sccs.h> ! 3: ! 4: SCCSID(@(#)syserr.c 7.2 8/23/83) ! 5: ! 6: /* ! 7: ** SYSERR -- SYStem ERRor message print and abort ! 8: ** ! 9: ** Syserr acts like a printf with up to five arguments. ! 10: ** ! 11: ** If the first argument to syserr is not zero, ! 12: ** the message "SYSERR:" is prepended. ! 13: ** ! 14: ** If the extern variable `Proc_name' is assigned to a ! 15: ** string, that string is prepended to the message. ! 16: ** ! 17: ** All arguments must be null-terminated. ! 18: ** ! 19: ** The function pointed to by `ExitFn' is then called. ! 20: ** It is initialized to be `exit'. ! 21: */ ! 22: ! 23: char *Proc_name; ! 24: int Accerror; ! 25: extern exit(), abort(); ! 26: int (*ExitFn)() = exit; ! 27: ! 28: syserr(pv) ! 29: char *pv; ! 30: { ! 31: int pid; ! 32: register char **p; ! 33: extern int errno; ! 34: register int usererr; ! 35: register int exitvalue; ! 36: ! 37: p = &pv; ! 38: printf("\n"); ! 39: usererr = pv == 0; ! 40: ! 41: if (!usererr) ! 42: { ! 43: if (Proc_name) ! 44: printf("%s ", Proc_name); ! 45: printf("\007SYSERR: "); ! 46: } ! 47: else ! 48: p++; ! 49: printf(p[0], p[1], p[2], p[3], p[4], p[5]); ! 50: printf("\007\n"); ! 51: exitvalue = -1; ! 52: if (!usererr) ! 53: { ! 54: if (errno) ! 55: { ! 56: exitvalue = errno; ! 57: perror("UNIX error"); ! 58: } ! 59: if (Accerror != 0) ! 60: { ! 61: printf("\taccess method error %d\n", Accerror); ! 62: } ! 63: } ! 64: fflush(stdout); ! 65: if (ExitFn == exit) ! 66: ExitFn = abort; ! 67: (*ExitFn)(exitvalue); ! 68: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.