xref: /inferno-os/lib9/sysfatal.c (revision c094a1409b780cc543c077e8469fdb28b4c90afb)
1 #include "lib9.h"
2 
3 
4 
5 static void
6 _sysfatalimpl(char *fmt, va_list arg)
7 {
8 	char buf[1024];
9 
10 	vseprint(buf, buf+sizeof(buf), fmt, arg);
11 	if(argv0)
12 		fprint(2, "%s: %s\n", argv0, buf);
13 	else
14 		fprint(2, "%s\n", buf);
15 	exits(buf);
16 }
17 
18 void (*_sysfatal)(char *fmt, va_list arg) = _sysfatalimpl;
19 
20 void
21 sysfatal(char *fmt, ...)
22 {
23 	va_list arg;
24 
25 	va_start(arg, fmt);
26 	(*_sysfatal)(fmt, arg);
27 	va_end(arg);
28 }
29