summaryrefslogtreecommitdiff
path: root/system/kbd/error.h
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-14 02:22:19 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-14 02:22:56 -0500
commitb1eb50599e4db7eb4501af75cbbfa22007081ea5 (patch)
treec94a34c882cc17adedd781e8c5f34349b2a62416 /system/kbd/error.h
parentb9e85bbdcf38547ef2ca4e5c2a6e6293bbcd2752 (diff)
downloadpackages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.gz
packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.bz2
packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.xz
packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.zip
The New Plan
all pkgs needed to bootstrap -> system others -> user
Diffstat (limited to 'system/kbd/error.h')
-rw-r--r--system/kbd/error.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/system/kbd/error.h b/system/kbd/error.h
new file mode 100644
index 000000000..5eb8ed511
--- /dev/null
+++ b/system/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