diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-05 20:36:51 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-05 20:36:51 +0200 |
commit | fef77e456edf06a0fdc945eca38cb943cffc3133 (patch) | |
tree | 0ab12c811c8a0a6bbeeaa9c4c0d43fbc13f05fe5 /src/libmdsserver | |
parent | add xsnprintf macro (diff) | |
download | mds-fef77e456edf06a0fdc945eca38cb943cffc3133.tar.gz mds-fef77e456edf06a0fdc945eca38cb943cffc3133.tar.bz2 mds-fef77e456edf06a0fdc945eca38cb943cffc3133.tar.xz |
use more macros
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsserver')
-rw-r--r-- | src/libmdsserver/macros.h | 22 |
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 |