diff options
author | Michael Meskes <meskes@debian.org> | 2008-08-27 13:45:17 +0200 |
---|---|---|
committer | Michael Meskes <meskes@debian.org> | 2008-08-27 13:45:17 +0200 |
commit | f06a98f0b468601fc1ab929b06a7962cca8614ea (patch) | |
tree | d1e64a0785f80b753f11d81a77f9cb27f86dcf0a /error.c |
Imported Upstream version 0.1
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -0,0 +1,20 @@ +#include <errno.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <signal.h> + +void error_exit(char *format, ...) +{ + char buffer[4096]; + va_list ap; + + va_start(ap, format); + vsnprintf(buffer, sizeof(buffer), format, ap); + va_end(ap); + + fprintf(stderr, "%s: errno=%d (if applicable)\n", buffer, errno); + + exit(EXIT_FAILURE); +} |