|
|
1.1 ! root 1: #ifndef lint ! 2: static char sccsid[] = "@(#)assert.c 5.2 (Berkeley) 7/2/83"; ! 3: #endif ! 4: ! 5: #include "uucp.h" ! 6: #include <sys/time.h> ! 7: #include <sys/types.h> ! 8: #include <errno.h> ! 9: ! 10: /******* ! 11: * assert - print out assetion error ! 12: * ! 13: * return code - none ! 14: */ ! 15: ! 16: assert(s1, s2, i1) ! 17: char *s1, *s2; ! 18: { ! 19: register FILE *errlog; ! 20: register struct tm *tp; ! 21: extern struct tm *localtime(); ! 22: extern time_t time(); ! 23: time_t clock; ! 24: int pid; ! 25: ! 26: if (Debug) ! 27: errlog = stderr; ! 28: else { ! 29: int savemask; ! 30: savemask = umask(LOGMASK); ! 31: errlog = fopen(ERRLOG, "a"); ! 32: umask(savemask); ! 33: } ! 34: if (errlog == NULL) ! 35: return; ! 36: ! 37: pid = getpid(); ! 38: fprintf(errlog, "ASSERT ERROR (%.9s) ", Progname); ! 39: fprintf(errlog, "pid: %d ", pid); ! 40: time(&clock); ! 41: tp = localtime(&clock); ! 42: fprintf(errlog, "(%d/%d-%d:%02d) ", tp->tm_mon + 1, ! 43: tp->tm_mday, tp->tm_hour, tp->tm_min); ! 44: fprintf(errlog, "%s %s (%d)\n", s1, s2, i1); ! 45: fclose(errlog); ! 46: return; ! 47: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.