Remove building with NOCRYPTO option
[minix.git] / external / bsd / nvi / dist / common / trace.c
blob059d469a09a4c40b806c08b81e02993be2f0be79
1 /* $NetBSD: trace.c,v 1.4 2014/01/26 21:43:45 christos Exp $ */
2 /*-
3 * Copyright (c) 1996
4 * Rob Zimmermann. All rights reserved.
5 * Copyright (c) 1996
6 * Keith Bostic. All rights reserved.
8 * See the LICENSE file for redistribution information.
9 */
11 #include "config.h"
13 #include <sys/cdefs.h>
14 #if 0
15 #ifndef lint
16 static const char sccsid[] = "Id: trace.c,v 8.4 1997/08/03 15:04:23 bostic Exp (Berkeley) Date: 1997/08/03 15:04:23 ";
17 #endif /* not lint */
18 #else
19 __RCSID("$NetBSD: trace.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
20 #endif
22 #include <sys/queue.h>
24 #include <bitstring.h>
25 #include <stdio.h>
27 #ifdef __STDC__
28 #include <stdarg.h>
29 #else
30 #include <varargs.h>
31 #endif
33 #include "common.h"
35 #ifdef TRACE
37 static FILE *tfp;
40 * vtrace_end --
41 * End tracing.
43 * PUBLIC: void vtrace_end __P((void));
45 void
46 vtrace_end(void)
48 if (tfp != NULL && tfp != stderr)
49 (void)fclose(tfp);
53 * vtrace_init --
54 * Initialize tracing.
56 * PUBLIC: void vtrace_init __P((const char *));
58 void
59 vtrace_init(const char *name)
61 if (name == NULL || (tfp = fopen(name, "w")) == NULL)
62 tfp = stderr;
63 vtrace("\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\nTRACE\n");
67 * vtrace --
68 * Debugging trace routine.
70 * PUBLIC: void vtrace __P((const char *, ...));
72 void
73 vtrace(const char *fmt, ...)
75 va_list ap;
77 if (tfp == NULL)
78 vtrace_init(NULL);
80 va_start(ap, fmt);
81 (void)vfprintf(tfp, fmt, ap);
82 va_end(ap);
84 (void)fflush(tfp);
86 #endif