1 /*
2 **        ____           _
3 **    ___|  _ \ ___ _ __| |
4 **   / _ \ |_) / _ \ '__| |
5 **  |  __/  __/  __/ |  | |
6 **   \___|_|   \___|_|  |_|
7 **
8 **  ePerl -- Embedded Perl 5 Language
9 **
10 **  ePerl interprets an ASCII file bristled with Perl 5 program statements
11 **  by evaluating the Perl 5 code while passing through the plain ASCII
12 **  data. It can operate both as a standard Unix filter for general file
13 **  generation tasks and as a powerful Webserver scripting language for
14 **  dynamic HTML page programming.
15 **
16 **  ======================================================================
17 **
18 **  Copyright (c) 1996,1997,1998 Ralf S. Engelschall <rse@engelschall.com>
19 **
20 **  This program is free software; it may be redistributed and/or modified
21 **  only under the terms of either the Artistic License or the GNU General
22 **  Public License, which may be found in the ePerl source distribution.
23 **  Look at the files ARTISTIC and COPYING or run ``eperl -l'' to receive
24 **  a built-in copy of both license files.
25 **
26 **  This program is distributed in the hope that it will be useful, but
27 **  WITHOUT ANY WARRANTY; without even the implied warranty of
28 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either the
29 **  Artistic License or the GNU General Public License for more details.
30 **
31 **  ======================================================================
32 **
33 **  eperl_debug.c -- ePerl debugging functions
34 */
35 
36 #include "eperl_config.h"
37 #include "eperl_global.h"
38 #include "eperl_proto.h"
39 
40 
41 int fDebug = FALSE;
42 char *cpDebugFile = "eperl.debug";
43 
Debug(char * str,...)44 void Debug(char *str, ...)
45 {
46 #ifdef DEBUG_ENABLED
47     va_list ap;
48     char buf[1024];
49     FILE *fp;
50 
51     va_start(ap, str);
52     if (fDebug) {
53         if ((fp = fopen(cpDebugFile, "a")) != NULL) {
54             vsprintf(buf, str, ap);
55             fprintf(fp, "%s", buf);
56             fclose(fp);
57         }
58     }
59     va_end(ap);
60     return;
61 #endif
62 }
63 
64 /*EOF*/
65