diff options
| author | Leo <thinkabit.ukim@gmail.com> | 2019-12-26 05:13:06 +0100 |
|---|---|---|
| committer | Natanael Copa <ncopa@alpinelinux.org> | 2019-12-26 11:29:26 +0000 |
| commit | 2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9 (patch) | |
| tree | 291b55a671c9856d1e90ce17cfe25313bab04e28 /main/elfutils/error.h | |
| parent | 1a1cbf4ee2c744a9b31f9c97f6eb1b28b7424065 (diff) | |
| download | aports-2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9.tar.bz2 aports-2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9.tar.xz | |
main/elfutils: upgrade to 0.178
Diffstat (limited to 'main/elfutils/error.h')
| -rw-r--r-- | main/elfutils/error.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/main/elfutils/error.h b/main/elfutils/error.h new file mode 100644 index 0000000000..ef06827a0b --- /dev/null +++ b/main/elfutils/error.h @@ -0,0 +1,27 @@ +#ifndef _ERROR_H_ +#define _ERROR_H_ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +static unsigned int error_message_count = 0; + +static inline void error(int status, int errnum, const char* format, ...) +{ + va_list ap; + fprintf(stderr, "%s: ", program_invocation_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + if (errnum) + fprintf(stderr, ": %s", strerror(errnum)); + fprintf(stderr, "\n"); + error_message_count++; + if (status) + exit(status); +} + +#endif /* _ERROR_H_ */ |
