forgot important file...
This commit is contained in:
parent
34f333404f
commit
ebe8f9460b
1 changed files with 33 additions and 0 deletions
33
sys/src/libbio/blethal.c
Normal file
33
sys/src/libbio/blethal.c
Normal file
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue