1 /*****
2 * Xnee's Not an Event Emulator
3 *
4 * Xnee enables recording and replaying of X protocol data
5 *
6 * Copyright (C) 1999, 2000, 2001, 2002, 2003 Henrik Sandklef
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 3
11 * of the License, or any later version.
12 *
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Boston,
22 * MA 02110-1301, USA.
23 ****/
24
25 #include "libxnee/xnee.h"
26 #include "libxnee/print.h"
27 #include "libxnee/print_varargs.h"
28
29 #ifdef HAVE_STDARG_H
30 #include <stdarg.h>
31 #else
32 #include <varargs.h>
33 #endif
34
35
36
37 /**************************************************************
38 * *
39 * xnee_verbose *
40 * *
41 * *
42 **************************************************************/
43 #ifdef HAVE_STDARG_H
44 void
xnee_verbosef(xnee_data * xd,char * msg,...)45 xnee_verbosef (xnee_data *xd, /*@null@*/ char * msg, ...)
46 {
47
48 va_list ap;
49
50 if (xd==NULL)
51 {
52 return;
53 }
54
55 if ( (xd->verbose!=0) && (xd->err_file!=NULL) )
56 {
57 va_start(ap, msg);
58 (void)xd->verbose_fp ( xd->err_file, msg, ap );
59 fflush(xd->err_file);
60 }
61 }
62
63 #else
64 void
xnee_verbosef(xnee_data * xd,valist)65 xnee_verbosef (xnee_data *xd, valist)
66 va_dcl
67 {
68 char *fmt;
69 va_list ap;
70
71 if (xd==NULL)
72 {
73 return;
74 }
75
76 if ( (xd->verbose!=0) && (xd->err_file!=NULL) )
77 {
78 va_start(argp);
79 fmt = va_arg(argp, char *);
80 xd->verbose_fp ( xd->err_file, msg, ap );
81 }
82 }
83 #endif
84
85
86
87
88 /*
89 * Print an error message
90 */
91 #ifdef HAVE_STDARG_H
92 void
xnee_print_error(char * error,...)93 xnee_print_error (char * error, ...)
94 {
95 va_list ap;
96 va_start(ap, error);
97 (void)vprintf ( error, ap );
98 va_end(ap);
99 }
100 #else
101 void
xnee_print_error(char * error,...)102 xnee_print_error (char * error, ...)
103 {
104 char *fmt;
105 va_list ap;
106 va_start(ap);
107 fmt = va_arg(argp, char *);
108 vprintf ( error, ap );
109 va_end(ap);
110 }
111 #endif
112
113
114