From 37da2899f40661e3e9631e497da8dc59b971cbd0 Mon Sep 17 00:00:00 2001 From: "Charles.Forsyth" Date: Fri, 22 Dec 2006 17:07:39 +0000 Subject: 20060303a --- lib9/sysfatal.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib9/sysfatal.c (limited to 'lib9/sysfatal.c') diff --git a/lib9/sysfatal.c b/lib9/sysfatal.c new file mode 100644 index 00000000..bb1f8e85 --- /dev/null +++ b/lib9/sysfatal.c @@ -0,0 +1,28 @@ +#include "lib9.h" + + + +static void +_sysfatalimpl(char *fmt, va_list arg) +{ + char buf[1024]; + + vseprint(buf, buf+sizeof(buf), fmt, arg); + if(argv0) + fprint(2, "%s: %s\n", argv0, buf); + else + fprint(2, "%s\n", buf); + exits(buf); +} + +void (*_sysfatal)(char *fmt, va_list arg) = _sysfatalimpl; + +void +sysfatal(char *fmt, ...) +{ + va_list arg; + + va_start(arg, fmt); + (*_sysfatal)(fmt, arg); + va_end(arg); +} -- cgit v1.2.3