blob: 38000aad6b8c236116f2d8101419a67e3673a462 (
plain)
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
|
#include <stdarg.h>
#include <stdio.h>
#include "rpmerr.h"
static struct err {
int code;
char string[1024];
} errorRec;
static CallBackType errorCallback = NULL;
int errCode(void)
{
return errorRec.code;
}
char *errCodeString(void)
{
return NULL;
}
char *errString(void)
{
return errorRec.string;
}
CallBackType errSetCallback(CallBackType cb)
{
CallBackType ocb;
ocb = errorCallback;
errorCallback = cb;
return ocb;
}
void error(int code, char *format, ...)
{
va_list args;
va_start(args, format);
errorRec.code = code;
vsprintf(errorRec.string, format, args);
if (errorCallback) {
errorCallback();
} else {
fputs(errorRec.string, stderr);
fputs("\n", stderr);
}
}
|