mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-12 18:41:51 +00:00
16 lines
373 B
Diff
16 lines
373 B
Diff
--- a/src/error.h
|
|
+++ b/src/error.h
|
|
@@ -0,0 +1,13 @@
|
|
+#ifndef _ERROR_H
|
|
+#define _ERROR_H 1
|
|
+
|
|
+#include <stdio.h>
|
|
+#include <stdlib.h>
|
|
+
|
|
+// mimic the behaviour of https://man7.org/linux/man-pages/man3/error.3.html
|
|
+void error(int status, int errnum, const char *format, ...)
|
|
+{
|
|
+ fprintf(stderr, "Error %d: %s", errnum, format);
|
|
+ if (status != 0) exit(status);
|
|
+}
|
|
+#endif
|