aboutsummaryrefslogtreecommitdiffstats
path: root/util/scan/scan.h
diff options
context:
space:
mode:
authoretobi <git@e-tobi.net>2013-09-03 09:48:38 +0200
committeretobi <git@e-tobi.net>2013-09-03 09:48:38 +0200
commit6e40287e2f39a80fc72bd8d0fbc1a8334d688c2d (patch)
tree024bef311226653bdd1da4fa588becf5098bcff7 /util/scan/scan.h
downloadlinux-dvb-apps-6e40287e2f39a80fc72bd8d0fbc1a8334d688c2d.tar.gz
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to '')
-rw-r--r--util/scan/scan.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/util/scan/scan.h b/util/scan/scan.h
new file mode 100644
index 0000000..8209076
--- /dev/null
+++ b/util/scan/scan.h
@@ -0,0 +1,29 @@
+#ifndef __SCAN_H__
+#define __SCAN_H__
+
+#include <stdio.h>
+#include <errno.h>
+
+extern int verbosity;
+
+#define dprintf(level, fmt...) \
+ do { \
+ if (level <= verbosity) \
+ fprintf(stderr, fmt); \
+ } while (0)
+
+#define dpprintf(level, fmt, args...) \
+ dprintf(level, "%s:%d: " fmt, __FUNCTION__, __LINE__ , ##args)
+
+#define fatal(fmt, args...) do { dpprintf(-1, "FATAL: " fmt , ##args); exit(1); } while(0)
+#define error(msg...) dprintf(0, "ERROR: " msg)
+#define errorn(msg) dprintf(0, "%s:%d: ERROR: " msg ": %d %m\n", __FUNCTION__, __LINE__, errno)
+#define warning(msg...) dprintf(1, "WARNING: " msg)
+#define info(msg...) dprintf(2, msg)
+#define verbose(msg...) dprintf(3, msg)
+#define moreverbose(msg...) dprintf(4, msg)
+#define debug(msg...) dpprintf(5, msg)
+#define verbosedebug(msg...) dpprintf(6, msg)
+
+#endif
+