source: abuse/trunk/src/imlib/dprint.cpp @ 48

Last change on this file since 48 was 4, checked in by Sam Hocevar, 17 years ago
  • debian patches
File size: 623 bytes
Line 
1#include <stdlib.h>
2#include <stdarg.h>
3#include <stdio.h>
4#include "macs.hpp"
5
6void  (*dprint_fun)(char *) = NULL;
7void  (*dget_fun)(char *,int) = NULL;
8
9void set_dprinter(void (*stat_fun)(char *))
10{
11        dprint_fun = stat_fun;
12}
13
14void set_dgetter(void (*stat_fun)(char *,int))
15{
16        dget_fun = stat_fun;
17}
18
19void dprintf(const char *format, ...)
20{
21        if (dprint_fun)
22        {
23                char st[1000];
24                va_list ap;
25
26                va_start(ap, format);
27                vsprintf(st,format,ap);
28                va_end(ap);
29                dprint_fun(st);
30        }
31}
32
33
34void dgets(char *buf, int size)
35{
36        if (dget_fun)
37        {
38                dget_fun(buf,size);
39        }
40        else
41        {
42                ERROR(0,"dgets called but no handler set up");
43        }
44}
Note: See TracBrowser for help on using the repository browser.