From ebe8f9460b6a3012c9c75d8479a3e427d5c04977 Mon Sep 17 00:00:00 2001 From: aiju Date: Wed, 13 Jul 2011 09:30:08 +0200 Subject: [PATCH] forgot important file... --- sys/src/libbio/blethal.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 sys/src/libbio/blethal.c 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 +#include +#include + +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; +}