aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmdsserver/macros.h')
-rw-r--r--src/libmdsserver/macros.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h
index 9225c49..392e0ff 100644
--- a/src/libmdsserver/macros.h
+++ b/src/libmdsserver/macros.h
@@ -20,6 +20,7 @@
#include <stdio.h>
+#include <unistd.h>
/**
@@ -33,5 +34,26 @@
snprintf(buffer, sizeof(buffer) / sizeof(char), format, __VA_ARGS__);
+/**
+ * Wrapper for `fprintf` that prints to `stderr` with
+ * the program name prefixed and new line suffixed
+ *
+ * @param format:char* The format
+ */
+#define eprint(format) \
+ fprintf(stderr, "%s: " format "\n", *argv);
+
+
+/**
+ * Wrapper for `fprintf` that prints to `stderr` with
+ * the program name prefixed and new line suffixed
+ *
+ * @param format:char* The format
+ * @param ... The arguments
+ */
+#define eprintf(format, ...) \
+ fprintf(stderr, "%s: " format "\n", *argv, __VA_ARGS__);
+
+
#endif