Revision d8e83543

View differences:

Makefile
34 34
ifdef DEBUG
35 35
CFLAGS += -O0
36 36
CPPFLAGS += -DDEBUG
37
OBJS += dbg.o
38 37
endif
38
OBJS += dbg.o
39 39

  
40 40

  
41 41
ifdef DEBUGOUT
dbg.c
8 8
#include <stdio.h>
9 9
#include <stdarg.h>
10 10

  
11
#include "dbg.h"
12

  
11 13
static struct timeval tnow;
12 14

  
13
int dtprintf2(const char *format, ...)
15
int ftprintf(FILE *stream, const char *format, ...)
14 16
{
15 17
  va_list ap;
16 18
  int ret;
17 19
  
18 20
  gettimeofday(&tnow, NULL);
19
  fprintf(stderr, "%ld.%03ld ", tnow.tv_sec, tnow.tv_usec/100);
21
  fprintf(stream, "%ld.%03ld ", tnow.tv_sec, tnow.tv_usec/1000);
20 22

  
21 23
  va_start (ap, format);
22 24
  ret = vfprintf(stderr, format, ap);
dbg.h
7 7
#ifndef DBG_H
8 8
#define DBG_H
9 9

  
10
#ifdef DEBUG
11

  
12 10
#include <stdio.h>
13 11

  
14
int dtprintf2(const char *format, ...);
12
int ftprintf(FILE *stream, const char *format, ...);
15 13

  
16
#include <stdio.h>
14
#ifdef DEBUG
17 15
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
18
#define dtprintf(...) dtprintf2(__VA_ARGS__)
16
#define dtprintf(...) ftprintf(stderr,__VA_ARGS__)
19 17
#else
20 18
#define dprintf(...)
21 19
#define dtprintf(...)

Also available in: Unified diff