home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
misc
/
src
/
rpm
/
lib
/
rpmerr.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-09-17
|
805b
|
54 lines
#include <stdarg.h>
#include <stdio.h>
#include "rpmlib.h"
static struct err {
int code;
char string[1024];
} errorRec;
static rpmErrorCallBackType errorCallback = NULL;
int rpmErrorCode(void)
{
return errorRec.code;
}
char *rpmErrorCodeString(void)
{
return NULL;
}
char *rpmErrorString(void)
{
return errorRec.string;
}
rpmErrorCallBackType rpmErrorSetCallback(rpmErrorCallBackType cb)
{
rpmErrorCallBackType ocb;
ocb = errorCallback;
errorCallback = cb;
return ocb;
}
void rpmError(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);
}
}