xref: /plan9/sys/src/libc/9sys/sysfatal.c (revision ff8c3af2f44d95267f67219afa20ba82ff6cf7e4)
1 #include <u.h>
2 #include <libc.h>
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