113636Ssam #ifndef lint
2*23586Sbloom static char sccsid[] = "@(#)assert.c 5.5 (Berkeley) 06/19/85";
313636Ssam #endif
413636Ssam
513636Ssam #include "uucp.h"
613704Ssam #include <sys/time.h>
713636Ssam #include <errno.h>
813636Ssam
9*23586Sbloom /*LINTLIBRARY*/
10*23586Sbloom
11*23586Sbloom /*
12*23586Sbloom * print out assetion error
1313636Ssam */
1413636Ssam
assert(s1,s2,i1)1513636Ssam assert(s1, s2, i1)
1613636Ssam char *s1, *s2;
1713636Ssam {
1813636Ssam register FILE *errlog;
1913636Ssam register struct tm *tp;
2013636Ssam extern struct tm *localtime();
2113636Ssam time_t clock;
2213636Ssam int pid;
2313636Ssam
2417832Sralph errlog = NULL;
2517832Sralph if (!Debug) {
2613636Ssam int savemask;
2713636Ssam savemask = umask(LOGMASK);
2813636Ssam errlog = fopen(ERRLOG, "a");
2913636Ssam umask(savemask);
3013636Ssam }
3113636Ssam if (errlog == NULL)
3217832Sralph errlog = stderr;
3313636Ssam
3413636Ssam pid = getpid();
3513636Ssam fprintf(errlog, "ASSERT ERROR (%.9s) ", Progname);
3613636Ssam fprintf(errlog, "pid: %d ", pid);
37*23586Sbloom (void) time(&clock);
3813636Ssam tp = localtime(&clock);
3917832Sralph #ifdef USG
4017832Sralph fprintf(errlog, "(%d/%d-%2.2d:%2.2d) ", tp->tm_mon + 1,
4113636Ssam tp->tm_mday, tp->tm_hour, tp->tm_min);
42*23586Sbloom #endif
43*23586Sbloom #ifndef USG
4417832Sralph fprintf(errlog, "(%d/%d-%02d:%02d) ", tp->tm_mon + 1,
4517832Sralph tp->tm_mday, tp->tm_hour, tp->tm_min);
4617832Sralph #endif
4717832Sralph fprintf(errlog, "%s %s (%d)\n", s1 ? s1 : "", s2 ? s2 : "", i1);
4817832Sralph if (errlog != stderr)
49*23586Sbloom (void) fclose(errlog);
5013636Ssam return;
5113636Ssam }
52