summaryrefslogtreecommitdiff
path: root/sys/src/libbio
diff options
context:
space:
mode:
authoraiju <aiju@phicode.de>2011-07-13 09:30:08 +0200
committeraiju <aiju@phicode.de>2011-07-13 09:30:08 +0200
commitebe8f9460b6a3012c9c75d8479a3e427d5c04977 (patch)
tree6d443d405982b1ece3a77536adcb7a1183f9b794 /sys/src/libbio
parent34f333404f958f8d93e8f1f582c0a347d2bfd64a (diff)
forgot important file...
Diffstat (limited to 'sys/src/libbio')
-rw-r--r--sys/src/libbio/blethal.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/src/libbio/blethal.c b/sys/src/libbio/blethal.c
new file mode 100644
index 000000000..11e1eedee
--- /dev/null
+++ b/sys/src/libbio/blethal.c
@@ -0,0 +1,33 @@
+#include <u.h>
+#include <libc.h>
+#include <bio.h>
+
+void
+Berror(Biobufhdr *bp, char *fmt, ...)
+{
+ va_list va;
+ char buf[ERRMAX];
+
+ if(bp->errorf == nil)
+ return;
+
+ va_start(va, fmt);
+ vsnprint(buf, ERRMAX, fmt, va);
+ va_end(va);
+ bp->errorf(buf);
+}
+
+static void
+Bpanic(char *s)
+{
+ sysfatal("%s", s);
+}
+
+void
+Blethal(Biobufhdr *bp, void (*errorf)(char *))
+{
+ if(errorf == nil)
+ errorf = Bpanic;
+
+ bp->errorf = errorf;
+}