date and time created 83/07/02 17:56:20 by sam
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 3 Jul 1983 08:56:20 +0000 (00:56 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 3 Jul 1983 08:56:20 +0000 (00:56 -0800)
SCCS-vsn: usr.bin/uucp/assert.c 5.1

usr/src/usr.bin/uucp/assert.c [new file with mode: 0644]

diff --git a/usr/src/usr.bin/uucp/assert.c b/usr/src/usr.bin/uucp/assert.c
new file mode 100644 (file)
index 0000000..9cf9212
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef lint
+static char sccsid[] = "@(#)assert.c   5.1 (Berkeley) %G%";
+#endif
+
+#include "uucp.h"
+#include <time.h>
+#include <sys/types.h>
+#include <errno.h>
+
+/*******
+ *     assert - print out assetion error
+ *
+ *     return code - none
+ */
+
+assert(s1, s2, i1)
+char *s1, *s2;
+{
+       register FILE *errlog;
+       register struct tm *tp;
+       extern struct tm *localtime();
+       extern time_t time();
+       time_t clock;
+       int pid;
+
+       if (Debug)
+               errlog = stderr;
+       else {
+               int savemask;
+               savemask = umask(LOGMASK);
+               errlog = fopen(ERRLOG, "a");
+               umask(savemask);
+       }
+       if (errlog == NULL)
+               return;
+
+       pid = getpid();
+       fprintf(errlog, "ASSERT ERROR (%.9s)  ", Progname);
+       fprintf(errlog, "pid: %d  ", pid);
+       time(&clock);
+       tp = localtime(&clock);
+       fprintf(errlog, "(%d/%d-%d:%02d) ", tp->tm_mon + 1,
+               tp->tm_mday, tp->tm_hour, tp->tm_min);
+       fprintf(errlog, "%s %s (%d)\n", s1, s2, i1);
+       fclose(errlog);
+       return;
+}