date and time created 85/01/22 13:49:28 by ralph
[unix-history] / usr / src / usr.bin / uucp / assert.c
CommitLineData
67577404 1#ifndef lint
88db71e9 2static char sccsid[] = "@(#)assert.c 5.3 (Berkeley) %G%";
67577404
SL
3#endif
4
5#include "uucp.h"
62ba4a08 6#include <sys/time.h>
67577404
SL
7#include <sys/types.h>
8#include <errno.h>
9
10/*******
11 * assert - print out assetion error
12 *
13 * return code - none
14 */
15
16assert(s1, s2, i1)
17char *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}