1 /*
2 * This file brings in support functions from Plan 9 libc and others
3 * in order to provide a decent wrapper to libsec.
4 */
5
6 #include "libc.h"
7
8 static void
_sysfatalimpl(char * fmt,va_list arg)9 _sysfatalimpl(char *fmt, va_list arg)
10 {
11 char buf[1024];
12
13 vseprint(buf, buf+sizeof(buf), fmt, arg);
14 if(argv0)
15 fprint(2, "%s: %s\n", argv0, buf);
16 else
17 fprint(2, "%s\n", buf);
18 exits(buf);
19 }
20
21 void (*_sysfatal)(char *fmt, va_list arg) = _sysfatalimpl;
22
23 void
sysfatal(char * fmt,...)24 sysfatal(char *fmt, ...)
25 {
26 va_list arg;
27
28 va_start(arg, fmt);
29 (*_sysfatal)(fmt, arg);
30 va_end(arg);
31 }
32