aboutsummaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
authorDavid <dbphillipsnz@gmail.com>2014-06-04 19:54:12 +1200
committerDavid <dbphillipsnz@gmail.com>2014-06-04 19:54:12 +1200
commitd1e3b814cbb9c08ce5a626445cd2930b13a9893c (patch)
tree3be25fcb01302bdf2ffc467907436aa6f58958a0 /common.h
parent2747e2b658b2f27897a80345cb3afb196c0e7c3b (diff)
downloadparamano-d1e3b814cbb9c08ce5a626445cd2930b13a9893c.tar.xz
Moved away from manual setting of sudo-ness
Diffstat (limited to 'common.h')
-rw-r--r--common.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/common.h b/common.h
index dfec86b..613541d 100644
--- a/common.h
+++ b/common.h
@@ -25,4 +25,24 @@ int get_int_value_from_file(const char* filename);
int get_int(const char* string);
bool file_has_line(const char *filename, const char *line);
+#include <stdio.h>
+// <ew> Stringification of line number
+#define STRING2(x) #x
+#define STRING(x) STRING2(x)
+#define STR_LINE STRING(__LINE__)
+// </ew>
+
+
+#ifdef DEBUG
+/*
+ Make debug macros into empty space if debug mode's not enabled.
+ Otherwise, make debug macro calls into appropriate printf()s
+*/
+ #define debug(...) printf("DEBUG: "__FILE__":"STR_LINE" --- "__VA_ARGS__)
+#else
+ #define debug(...);
+#endif
+
+#define info(...) printf("INFO: "__FILE__":"STR_LINE" --- "__VA_ARGS__)
+
#endif