tools/llvm: Do not build with symbols
[minix3.git] / external / bsd / nvi / dist / common / trace.c
blobf096c2db8ed19147b483111d4cd810e1547f1827
1 /* $NetBSD: trace.c,v 1.3 2013/11/29 16:36:11 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 #ifndef lint
14 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 ";
15 #endif /* not lint */
17 #include <sys/queue.h>
19 #include <bitstring.h>
20 #include <stdio.h>
22 #ifdef __STDC__
23 #include <stdarg.h>
24 #else
25 #include <varargs.h>
26 #endif
28 #include "common.h"
30 #ifdef TRACE
32 static FILE *tfp;
35 * vtrace_end --
36 * End tracing.
38 * PUBLIC: void vtrace_end __P((void));
40 void
41 vtrace_end(void)
43 if (tfp != NULL && tfp != stderr)
44 (void)fclose(tfp);
48 * vtrace_init --
49 * Initialize tracing.
51 * PUBLIC: void vtrace_init __P((const char *));
53 void
54 vtrace_init(const char *name)
56 if (name == NULL || (tfp = fopen(name, "w")) == NULL)
57 tfp = stderr;
58 vtrace("\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\nTRACE\n");
62 * vtrace --
63 * Debugging trace routine.
65 * PUBLIC: void vtrace __P((const char *, ...));
67 void
68 vtrace(const char *fmt, ...)
70 va_list ap;
72 if (tfp == NULL)
73 vtrace_init(NULL);
75 va_start(ap, fmt);
76 (void)vfprintf(tfp, fmt, ap);
77 va_end(ap);
79 (void)fflush(tfp);
81 #endif