This brings our tree to NetBSD 7.0, as found on -current on the 10-10-2015. This updates: - LLVM to 3.6.1 - GCC to GCC 5.1 - Replace minix/commands/zdump with usr.bin/zdump - external/bsd/libelf has moved to /external/bsd/elftoolchain/ - Import ctwm - Drop sprintf from libminc Change-Id: I149836ac18e9326be9353958bab9b266efb056f0
87 lines
1.4 KiB
C
87 lines
1.4 KiB
C
/* $NetBSD: trace.c,v 1.4 2014/01/26 21:43:45 christos Exp $ */
|
|
/*-
|
|
* Copyright (c) 1996
|
|
* Rob Zimmermann. All rights reserved.
|
|
* Copyright (c) 1996
|
|
* Keith Bostic. All rights reserved.
|
|
*
|
|
* See the LICENSE file for redistribution information.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <sys/cdefs.h>
|
|
#if 0
|
|
#ifndef lint
|
|
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 ";
|
|
#endif /* not lint */
|
|
#else
|
|
__RCSID("$NetBSD: trace.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
|
|
#endif
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#include <bitstring.h>
|
|
#include <stdio.h>
|
|
|
|
#ifdef __STDC__
|
|
#include <stdarg.h>
|
|
#else
|
|
#include <varargs.h>
|
|
#endif
|
|
|
|
#include "common.h"
|
|
|
|
#ifdef TRACE
|
|
|
|
static FILE *tfp;
|
|
|
|
/*
|
|
* vtrace_end --
|
|
* End tracing.
|
|
*
|
|
* PUBLIC: void vtrace_end __P((void));
|
|
*/
|
|
void
|
|
vtrace_end(void)
|
|
{
|
|
if (tfp != NULL && tfp != stderr)
|
|
(void)fclose(tfp);
|
|
}
|
|
|
|
/*
|
|
* vtrace_init --
|
|
* Initialize tracing.
|
|
*
|
|
* PUBLIC: void vtrace_init __P((const char *));
|
|
*/
|
|
void
|
|
vtrace_init(const char *name)
|
|
{
|
|
if (name == NULL || (tfp = fopen(name, "w")) == NULL)
|
|
tfp = stderr;
|
|
vtrace("\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\nTRACE\n");
|
|
}
|
|
|
|
/*
|
|
* vtrace --
|
|
* Debugging trace routine.
|
|
*
|
|
* PUBLIC: void vtrace __P((const char *, ...));
|
|
*/
|
|
void
|
|
vtrace(const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
if (tfp == NULL)
|
|
vtrace_init(NULL);
|
|
|
|
va_start(ap, fmt);
|
|
(void)vfprintf(tfp, fmt, ap);
|
|
va_end(ap);
|
|
|
|
(void)fflush(tfp);
|
|
}
|
|
#endif
|