From fef77e456edf06a0fdc945eca38cb943cffc3133 Mon Sep 17 00:00:00 2001
From: Mattias Andrée <maandree@operamail.com>
Date: Mon, 5 May 2014 20:36:51 +0200
Subject: use more macros
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Mattias Andrée <maandree@operamail.com>
---
 src/libmdsserver/macros.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

(limited to 'src/libmdsserver')

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
 
-- 
cgit v1.2.3-70-g09d2