summaryrefslogtreecommitdiffstats
path: root/pcilib/error.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-04-24 05:35:48 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-04-24 05:35:48 +0200
commitdcd8ad63316eac672492bc18112bbbb52811c3fc (patch)
tree321ed207442ebfe9b1feb8375de03847ed2e2de3 /pcilib/error.c
parent5f6fb4e4e77f121e0756744df8498520d4deddb8 (diff)
downloadpcitool-dcd8ad63316eac672492bc18112bbbb52811c3fc.tar.gz
pcitool-dcd8ad63316eac672492bc18112bbbb52811c3fc.tar.bz2
pcitool-dcd8ad63316eac672492bc18112bbbb52811c3fc.tar.xz
pcitool-dcd8ad63316eac672492bc18112bbbb52811c3fc.zip
More structural changes to get ready for stand-alone event engines
Diffstat (limited to 'pcilib/error.c')
-rw-r--r--pcilib/error.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/pcilib/error.c b/pcilib/error.c
new file mode 100644
index 0000000..f242209
--- /dev/null
+++ b/pcilib/error.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "config.h"
+#include "error.h"
+
+void pcilib_print_error(const char *msg, ...) {
+ va_list va;
+
+ va_start(va, msg);
+ vprintf(msg, va);
+ va_end(va);
+ printf("\n");
+}
+
+
+int pcilib_set_error_handler(void (*err)(const char *msg, ...), void (*warn)(const char *msg, ...)) {
+ if (err) pcilib_error = err;
+ else pcilib_error = pcilib_print_error;
+ if (warn) pcilib_warning = warn;
+ else pcilib_warning = pcilib_print_error;
+
+ return 0;
+}