File: dprint.c

package info (click to toggle)
abuse 2.00-12
  • links: PTS
  • area: main
  • in suites: slink
  • size: 12,708 kB
  • ctags: 15,389
  • sloc: ansic: 115,852; cpp: 6,792; lisp: 2,066; sh: 1,734; makefile: 1,601; asm: 264
file content (44 lines) | stat: -rw-r--r-- 693 bytes parent folder | download | duplicates (6)
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
#include <stdlib.h>
#ifdef __WATCOMC__
#include "i86.h"
#endif
#include <stdarg.h>
#include <stdio.h>
#include "macs.hpp"

void  (*dprint_fun)(char *)=NULL;
void  (*dget_fun)(char *,int)=NULL;

void set_dprinter(void (*stat_fun)(char *))
{
  dprint_fun=stat_fun;
}

void set_dgetter(void (*stat_fun)(char *,int))
{
  dget_fun=stat_fun;
}

void dprintf(const char *format, ...)
{
  if (dprint_fun)
  {
    char st[1000],a,*sp;
    int y;
    va_list ap;
    va_start(ap, format);
    vsprintf(st,format,ap);
    va_end(ap);
    dprint_fun(st);
  }
}


void dgets(char *buf, int size)
{
  if (dget_fun)
  {
    dget_fun(buf,size);
  } else
    ERROR(0,"dgets called but no handler set up");  
}