summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authormarc <devnull@localhost>1995-12-18 14:48:03 +0000
committermarc <devnull@localhost>1995-12-18 14:48:03 +0000
commit8a0ef9fe18d69eb784f2c4c75f2347f0fd1d4229 (patch)
tree565dfbfa0fd226fec21e994c41679f8b66e3e11c /rpmio
parent033609ea2d5c22c48329b2181dc82c4167fd41cc (diff)
downloadrpm-8a0ef9fe18d69eb784f2c4c75f2347f0fd1d4229.tar.gz
rpm-8a0ef9fe18d69eb784f2c4c75f2347f0fd1d4229.tar.bz2
rpm-8a0ef9fe18d69eb784f2c4c75f2347f0fd1d4229.zip
made global error structure, and functions to read/write it
,. CVS patchset: 47 CVS date: 1995/12/18 14:48:03
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/rpmerr.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/rpmio/rpmerr.c b/rpmio/rpmerr.c
index 17c22228c..e20bdc6f5 100644
--- a/rpmio/rpmerr.c
+++ b/rpmio/rpmerr.c
@@ -3,12 +3,48 @@
#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();
+ }
}