Commit | Line | Data |
---|---|---|
67577404 | 1 | #ifndef lint |
88db71e9 | 2 | static 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 | ||
16 | assert(s1, s2, i1) | |
17 | char *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 | ||
46b15d8a RC |
26 | errlog = NULL; |
27 | if (!Debug) { | |
67577404 SL |
28 | int savemask; |
29 | savemask = umask(LOGMASK); | |
30 | errlog = fopen(ERRLOG, "a"); | |
31 | umask(savemask); | |
32 | } | |
33 | if (errlog == NULL) | |
46b15d8a | 34 | errlog = stderr; |
67577404 SL |
35 | |
36 | pid = getpid(); | |
37 | fprintf(errlog, "ASSERT ERROR (%.9s) ", Progname); | |
38 | fprintf(errlog, "pid: %d ", pid); | |
39 | time(&clock); | |
40 | tp = localtime(&clock); | |
46b15d8a RC |
41 | #ifdef USG |
42 | fprintf(errlog, "(%d/%d-%2.2d:%2.2d) ", tp->tm_mon + 1, | |
67577404 | 43 | tp->tm_mday, tp->tm_hour, tp->tm_min); |
46b15d8a RC |
44 | #else |
45 | fprintf(errlog, "(%d/%d-%02d:%02d) ", tp->tm_mon + 1, | |
46 | tp->tm_mday, tp->tm_hour, tp->tm_min); | |
47 | #endif | |
48 | fprintf(errlog, "%s %s (%d)\n", s1 ? s1 : "", s2 ? s2 : "", i1); | |
49 | if (errlog != stderr) | |
50 | fclose(errlog); | |
67577404 SL |
51 | return; |
52 | } |