diff options
author | marc <devnull@localhost> | 1995-12-18 14:48:03 +0000 |
---|---|---|
committer | marc <devnull@localhost> | 1995-12-18 14:48:03 +0000 |
commit | 8a0ef9fe18d69eb784f2c4c75f2347f0fd1d4229 (patch) | |
tree | 565dfbfa0fd226fec21e994c41679f8b66e3e11c /rpmio | |
parent | 033609ea2d5c22c48329b2181dc82c4167fd41cc (diff) | |
download | rpm-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.c | 40 |
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(); + } } |