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