diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-04-24 18:37:11 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-04-24 18:37:11 -0400 |
| commit | 072f0c594526d96dac1c181d057eb9cf5d16862d (patch) | |
| tree | f085f52fdbbced413f9e510e3ca4174a84be251f /eprintf.c | |
| parent | 48bc192d262416e9466922c4b65b066ee6027d9a (diff) | |
| download | volute-072f0c594526d96dac1c181d057eb9cf5d16862d.zip | |
eprintf
Diffstat (limited to 'eprintf.c')
| -rw-r--r-- | eprintf.c | 27 |
1 files changed, 27 insertions, 0 deletions
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 <stdarg.h> +#include <stdio.h> +#include <stdlib.h> + +#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); +} |