1 /*
2  * Copyright (C) 1990 Regents of the University of California.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and
5  * its documentation for any purpose is hereby granted without fee,
6  * provided that the above copyright notice appear in all copies and that
7  * both that copyright notice and this permission notice appear in
8  * supporting documentation, and that the name of the University of
9  * California not be used in advertising or publicity pertaining to
10  * distribution of the software without specific, written prior
11  * permission.  the University of California makes no representations
12  * about the suitability of this software for any purpose.  It is provided
13  * "as is" without express or implied warranty.
14  */
15 
16 # include <X11/Intrinsic.h>
17 
18 # include <stdarg.h>
19 # include <stdio.h>
20 
21 # include "debug.h"
22 
23 #include "app.h"
24 
25 extern AppData app_data;
26 
27 /* VARARGS */
28 void
debug_printf(int flag,char * fmt,...)29 debug_printf(int flag, char *fmt, ...)
30 {
31 	va_list		args;
32 
33 	va_start(args, fmt);
34 
35 	/*
36 	 * first arg is whether or not to print.
37 	 */
38 	if ((flag == 0) || (app_data.debug == False))
39 		return;
40 
41 	vfprintf(stdout, fmt, args);
42 
43 	fflush(stdout);
44 
45 	va_end(args);
46 }
47