1*bf840df2Swiz /* $NetBSD: debug.c,v 1.3 2002/05/26 00:02:07 wiz Exp $ */ 241fe218bScgd 341fe218bScgd /* 441fe218bScgd * Copyright 1996 John D. Polstra. 541fe218bScgd * Copyright 1996 Matt Thomas <matt@3am-software.com> 641fe218bScgd * All rights reserved. 741fe218bScgd * 841fe218bScgd * Redistribution and use in source and binary forms, with or without 941fe218bScgd * modification, are permitted provided that the following conditions 1041fe218bScgd * are met: 1141fe218bScgd * 1. Redistributions of source code must retain the above copyright 1241fe218bScgd * notice, this list of conditions and the following disclaimer. 1341fe218bScgd * 2. Redistributions in binary form must reproduce the above copyright 1441fe218bScgd * notice, this list of conditions and the following disclaimer in the 1541fe218bScgd * documentation and/or other materials provided with the distribution. 1641fe218bScgd * 3. All advertising materials mentioning features or use of this software 1741fe218bScgd * must display the following acknowledgement: 1841fe218bScgd * This product includes software developed by John Polstra. 1941fe218bScgd * 4. The name of the author may not be used to endorse or promote products 2041fe218bScgd * derived from this software without specific prior written permission. 2141fe218bScgd * 2241fe218bScgd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2341fe218bScgd * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2441fe218bScgd * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2541fe218bScgd * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2641fe218bScgd * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2741fe218bScgd * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2841fe218bScgd * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2941fe218bScgd * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3041fe218bScgd * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3141fe218bScgd * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3241fe218bScgd */ 3341fe218bScgd 3441fe218bScgd /* 3541fe218bScgd * Support for printing debugging messages. 3641fe218bScgd */ 3741fe218bScgd 3826475619Schristos #include <sys/cdefs.h> 3941fe218bScgd #include <stdarg.h> 4041fe218bScgd 4141fe218bScgd #include "debug.h" 4241fe218bScgd #include "rtldenv.h" 4341fe218bScgd 4441fe218bScgd #ifdef DEBUG 4541fe218bScgd int debug = 0; 4641fe218bScgd 4741fe218bScgd void 4841fe218bScgd debug_printf(const char *format, ...) 4941fe218bScgd { 5041fe218bScgd if(debug) { 5141fe218bScgd va_list ap; 52*bf840df2Swiz 5341fe218bScgd va_start(ap, format); 5441fe218bScgd xvprintf(format, ap); 5541fe218bScgd va_end(ap); 5641fe218bScgd xprintf("\n"); 5741fe218bScgd } 5841fe218bScgd } 5941fe218bScgd #endif 60