File: eperl_debug.c

package info (click to toggle)
eperl 2.2.14-23
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, buster, sid, trixie
  • size: 2,320 kB
  • sloc: ansic: 4,692; perl: 584; sh: 556; makefile: 359
file content (65 lines) | stat: -rw-r--r-- 1,978 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
**        ____           _ 
**    ___|  _ \ ___ _ __| |
**   / _ \ |_) / _ \ '__| |
**  |  __/  __/  __/ |  | |
**   \___|_|   \___|_|  |_|
** 
**  ePerl -- Embedded Perl 5 Language
**
**  ePerl interprets an ASCII file bristled with Perl 5 program statements
**  by evaluating the Perl 5 code while passing through the plain ASCII
**  data. It can operate both as a standard Unix filter for general file
**  generation tasks and as a powerful Webserver scripting language for
**  dynamic HTML page programming. 
**
**  ======================================================================
**
**  Copyright (c) 1996,1997,1998,1999 Ralf S. Engelschall <rse@engelschall.com>
**
**  This program is free software; it may be redistributed and/or modified
**  only under the terms of either the Artistic License or the GNU General
**  Public License, which may be found in the ePerl source distribution.
**  Look at the files ARTISTIC and COPYING or run ``eperl -l'' to receive
**  a built-in copy of both license files.
**
**  This program is distributed in the hope that it will be useful, but
**  WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either the
**  Artistic License or the GNU General Public License for more details.
**
**  ======================================================================
**
**  eperl_debug.c -- ePerl debugging functions
*/

#include "eperl_config.h"
#include "eperl_global.h"
#include "eperl_proto.h"


int fDebug = FALSE;
char *cpDebugFile = "eperl.debug";

void Debug(char *str, ...)
{
#ifdef DEBUG_ENABLED
    va_list ap;
    char buf[1024];
    FILE *fp;

    va_start(ap, str);
    if (fDebug) {
        if ((fp = fopen(cpDebugFile, "a")) != NULL) {
            vsnprintf(buf, sizeof(buf), str, ap);
            buf[sizeof(buf)-1] = '\0';
            fprintf(fp, "%s", buf);
            fclose(fp);
        }
    }
    va_end(ap);
    return;
#endif
}

/*EOF*/