summaryrefslogtreecommitdiffstats
path: root/sxiv.h
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-01-17 16:42:13 +0100
committerBert <ber.t@gmx.com>2011-01-17 16:42:13 +0100
commitbbe7ae04702e8e7897de6c7f87d5d8b844e46256 (patch)
treea309fe56418558f424f4d12a780407bdc538f3a5 /sxiv.h
parentb9cd06df95af87055492dbd29b465c4748586621 (diff)
downloadnsxiv-bbe7ae04702e8e7897de6c7f87d5d8b844e46256.tar.zst
WARN and FATAL macros
Diffstat (limited to 'sxiv.h')
-rw-r--r--sxiv.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/sxiv.h b/sxiv.h
index e5458d5..f26a84f 100644
--- a/sxiv.h
+++ b/sxiv.h
@@ -23,4 +23,22 @@
#define VERSION "git-20110117"
+#define WARN(...) \
+ do { \
+ fprintf(stderr, "sxiv: %s:%d: warning: ", __FILE__, __LINE__); \
+ fprintf(stderr, __VA_ARGS__); \
+ fprintf(stderr, "\n"); \
+ } while (0)
+
+#define FATAL(...) \
+ do { \
+ fprintf(stderr, "sxiv: %s:%d: error: ", __FILE__, __LINE__); \
+ fprintf(stderr, __VA_ARGS__); \
+ fprintf(stderr, "\n"); \
+ cleanup(); \
+ exit(1); \
+ } while (0)
+
+void cleanup();
+
#endif /* SXIV_H */