diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-08-19 13:03:53 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-08-20 08:02:58 +0000 |
commit | b07dc2349d3e60bef40a9974f8b20e8158d989e8 (patch) | |
tree | 6ec2d24acc3a3764c77002d0e9629f2d26b2bc32 /main/kbd/error.h | |
parent | c899e9941b773827ef155a4b42c6b9a950841f80 (diff) | |
download | aports-b07dc2349d3e60bef40a9974f8b20e8158d989e8.tar.bz2 aports-b07dc2349d3e60bef40a9974f8b20e8158d989e8.tar.xz |
main/kbd: fix build with musl and upgrade to 2.0.2
ref #2977
Diffstat (limited to 'main/kbd/error.h')
-rw-r--r-- | main/kbd/error.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/main/kbd/error.h b/main/kbd/error.h new file mode 100644 index 0000000000..5eb8ed5115 --- /dev/null +++ b/main/kbd/error.h @@ -0,0 +1,20 @@ +#ifndef ERROR_H +#define ERROR_H + +#include <stdio.h> +#include <stdarg.h> +#include <err.h> + +static inline void error(int status, int errnum, const char *fmt, ...) +{ + va_list ap; + void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx }; + void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx }; + fflush(stdout); + va_start(ap, fmt); + if (status != 0) + errfunc[errnum==0](status, fmt, ap); /* does not return */ + warnfunc[errnum==0](fmt, ap); + va_end(ap); +} +#endif |