use syslog for errors
[unix-history] / usr / src / usr.bin / uucp / assert.c
CommitLineData
67577404 1#ifndef lint
d7bd02e4 2static char sccsid[] = "@(#)assert.c 5.5 (Berkeley) %G%";
67577404
SL
3#endif
4
5#include "uucp.h"
62ba4a08 6#include <sys/time.h>
67577404
SL
7#include <errno.h>
8
d7bd02e4
JB
9/*LINTLIBRARY*/
10
11/*
12 * print out assetion error
67577404
SL
13 */
14
15assert(s1, s2, i1)
16char *s1, *s2;
17{
18 register FILE *errlog;
19 register struct tm *tp;
20 extern struct tm *localtime();
67577404
SL
21 time_t clock;
22 int pid;
23
46b15d8a
RC
24 errlog = NULL;
25 if (!Debug) {
67577404
SL
26 int savemask;
27 savemask = umask(LOGMASK);
28 errlog = fopen(ERRLOG, "a");
29 umask(savemask);
30 }
31 if (errlog == NULL)
46b15d8a 32 errlog = stderr;
67577404
SL
33
34 pid = getpid();
35 fprintf(errlog, "ASSERT ERROR (%.9s) ", Progname);
36 fprintf(errlog, "pid: %d ", pid);
d7bd02e4 37 (void) time(&clock);
67577404 38 tp = localtime(&clock);
46b15d8a
RC
39#ifdef USG
40 fprintf(errlog, "(%d/%d-%2.2d:%2.2d) ", tp->tm_mon + 1,
67577404 41 tp->tm_mday, tp->tm_hour, tp->tm_min);
d7bd02e4
JB
42#endif
43#ifndef USG
46b15d8a
RC
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)
d7bd02e4 49 (void) fclose(errlog);
67577404
SL
50 return;
51}