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

Last change on this file since 2 was 2, checked in by Sam Hocevar, 17 years ago
  • imported original 0.7.0 tarball
File size: 638 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],a,*sp;
24                int y;
25                va_list ap;
26
27                va_start(ap, format);
28                vsprintf(st,format,ap);
29                va_end(ap);
30                dprint_fun(st);
31        }
32}
33
34
35void dgets(char *buf, int size)
36{
37        if (dget_fun)
38        {
39                dget_fun(buf,size);
40        }
41        else
42        {
43                ERROR(0,"dgets called but no handler set up");
44        }
45}
Note: See TracBrowser for help on using the repository browser.