From 072f0c594526d96dac1c181d057eb9cf5d16862d Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Thu, 24 Apr 2025 18:37:11 -0400 Subject: eprintf --- eprintf.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 eprintf.c (limited to 'eprintf.c') diff --git a/eprintf.c b/eprintf.c new file mode 100644 index 0000000..386293b --- /dev/null +++ b/eprintf.c @@ -0,0 +1,27 @@ +#include +#include +#include + +#include "eprintf.h" + +void +eprintf(const char *fmt, ...) { + va_list args; + + va_start(args, fmt); + fprintf(stderr, "error: "); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); + va_end(args); + exit(1); +} + +void weprintf(const char *fmt, ...) { + va_list args; + + va_start(args, fmt); + fprintf(stderr, "warning: "); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); + va_end(args); +} -- cgit v1.2.3