From d7ce046606ce05dd8a37e83fc48667bbe4c20093 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Mon, 22 May 2023 15:25:25 +0530 Subject: initial commit --- util.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 util.c (limited to 'util.c') diff --git a/util.c b/util.c new file mode 100644 index 0000000..d8c65b8 --- /dev/null +++ b/util.c @@ -0,0 +1,22 @@ +#include +#include +#include +#include +#include +#include "util.h" + +void die(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + fprintf(stderr, "error: "); + vfprintf(stderr, fmt, ap); + if (errno) + fprintf(stderr, " (%d): %s\n", errno, strerror(errno)); + else + fputc('\n', stderr);; + va_end(ap); + + exit(errno); +} -- cgit v1.2.3