File: error.c

package info (click to toggle)
abiword 0.7.7-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 20,604 kB
  • ctags: 18,358
  • sloc: cpp: 88,791; ansic: 66,296; sh: 7,777; makefile: 3,397; xml: 687; perl: 361; awk: 273; sed: 36; csh: 28
file content (73 lines) | stat: -rw-r--r-- 1,168 bytes parent folder | download
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include "wv.h"

FILE *wverror=NULL;
FILE *wvwarn=NULL;
FILE *wvtrace=NULL;

void wvInitError(void)
	{
	wverror=stderr;
	wvwarn=stderr;
	wvtrace=stderr;
	}

char * wvFmtMsg(char *fmt, ...)
	{
	static char mybuf[1024];
	
    va_list argp;
    va_start(argp, fmt);
    vsprintf(mybuf, fmt, argp);
    va_end(argp);

	return mybuf;
}

void wvRealError(char *file, int line, char * msg)
    {
	if (wverror == NULL)
		return;
    fprintf(wverror, "wvError: (%s:%d) %s ",file,line, msg);
    fflush(wverror);
    }

void wvWarning(char *fmt, ...)
    {
    va_list argp;
	if (wvwarn == NULL)
		return;
    fprintf(wvwarn, "wvWarning: ");
    va_start(argp, fmt);
    vfprintf(wvwarn, fmt, argp);
    va_end(argp);
    fflush(wvwarn);
    }

void wvRealTrace(char *file, int line, char * msg)
    {
#ifdef DEBUG
    if (wvtrace == NULL)
        return;
    fprintf(wvtrace , "wvTrace: (%s:%d) %s ",file,line, msg);
    fflush(wvtrace);
#endif
    }


void wvSetErrorStream(FILE *in)
    {
	wverror = in;
    }

void wvSetWarnStream(FILE *in)
	{
	wvwarn = in;
	}

void wvSetTraceStream(FILE *in)
	{
	wvtrace = in;
	}