,.
CVS patchset: 47
CVS date: 1995/12/18 14:48:03
#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);
- fprintf(stderr, "ERROR(%d): ", code);
- vfprintf(stdout, format, args);
+ errorRec.code = code;
+ vsprintf(errorRec.string, format, args);
+
+ if (errorCallback) {
+ errorCallback();
+ }
}
#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);
- fprintf(stderr, "ERROR(%d): ", code);
- vfprintf(stdout, format, args);
+ errorRec.code = code;
+ vsprintf(errorRec.string, format, args);
+
+ if (errorCallback) {
+ errorCallback();
+ }
}