File: debuglog.c

package info (click to toggle)
termrec 0.19-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,148 kB
  • sloc: ansic: 8,430; makefile: 181; perl: 16; sh: 15
file content (26 lines) | stat: -rw-r--r-- 381 bytes parent folder | download | duplicates (4)
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
#include "config.h"
#include <stdio.h>
#include <stdarg.h>
#include "utils.h"

#ifdef IS_WIN32
# define DEBUGLOG "log.txt"
#else
# define DEBUGLOG "log"
#endif

static int once=0;

void debuglog(const char *txt, ...)
{
    va_list ap;
    FILE *f;

    f=fopen(DEBUGLOG, once?"a":"w");
    once=1;

    va_start(ap, txt);
    vfprintf(f, txt, ap);
    va_end(ap);
    fclose(f);
}