113636Ssam #ifndef lint 2*17832Sralph static char sccsid[] = "@(#)assert.c 5.3 (Berkeley) 01/22/85"; 313636Ssam #endif 413636Ssam 513636Ssam #include "uucp.h" 613704Ssam #include <sys/time.h> 713636Ssam #include <sys/types.h> 813636Ssam #include <errno.h> 913636Ssam 1013636Ssam /******* 1113636Ssam * assert - print out assetion error 1213636Ssam * 1313636Ssam * return code - none 1413636Ssam */ 1513636Ssam 1613636Ssam assert(s1, s2, i1) 1713636Ssam char *s1, *s2; 1813636Ssam { 1913636Ssam register FILE *errlog; 2013636Ssam register struct tm *tp; 2113636Ssam extern struct tm *localtime(); 2213636Ssam extern time_t time(); 2313636Ssam time_t clock; 2413636Ssam int pid; 2513636Ssam 26*17832Sralph errlog = NULL; 27*17832Sralph if (!Debug) { 2813636Ssam int savemask; 2913636Ssam savemask = umask(LOGMASK); 3013636Ssam errlog = fopen(ERRLOG, "a"); 3113636Ssam umask(savemask); 3213636Ssam } 3313636Ssam if (errlog == NULL) 34*17832Sralph errlog = stderr; 3513636Ssam 3613636Ssam pid = getpid(); 3713636Ssam fprintf(errlog, "ASSERT ERROR (%.9s) ", Progname); 3813636Ssam fprintf(errlog, "pid: %d ", pid); 3913636Ssam time(&clock); 4013636Ssam tp = localtime(&clock); 41*17832Sralph #ifdef USG 42*17832Sralph fprintf(errlog, "(%d/%d-%2.2d:%2.2d) ", tp->tm_mon + 1, 4313636Ssam tp->tm_mday, tp->tm_hour, tp->tm_min); 44*17832Sralph #else 45*17832Sralph fprintf(errlog, "(%d/%d-%02d:%02d) ", tp->tm_mon + 1, 46*17832Sralph tp->tm_mday, tp->tm_hour, tp->tm_min); 47*17832Sralph #endif 48*17832Sralph fprintf(errlog, "%s %s (%d)\n", s1 ? s1 : "", s2 ? s2 : "", i1); 49*17832Sralph if (errlog != stderr) 50*17832Sralph fclose(errlog); 5113636Ssam return; 5213636Ssam } 53