Krolyxon
Commit bbe7ae0

Branches

Refs →

nsxivbbe7ae0

WARN and FATAL macros

Author
Bert
Date
2011-01-17 16:42 +0100
Parent
b9cd06d
Commit
bbe7ae04702e8e7897de6c7f87d5d8b844e46256

+18 −0

1 file changed

  1. M sxiv.h +18 −0
M sxiv.h View
@@ -23,4 +23,22 @@
2323
2424 #define VERSION "git-20110117"
2525
26+#define WARN(...) \
27+ do { \
28+ fprintf(stderr, "sxiv: %s:%d: warning: ", __FILE__, __LINE__); \
29+ fprintf(stderr, __VA_ARGS__); \
30+ fprintf(stderr, "\n"); \
31+ } while (0)
32+
33+#define FATAL(...) \
34+ do { \
35+ fprintf(stderr, "sxiv: %s:%d: error: ", __FILE__, __LINE__); \
36+ fprintf(stderr, __VA_ARGS__); \
37+ fprintf(stderr, "\n"); \
38+ cleanup(); \
39+ exit(1); \
40+ } while (0)
41+
42+void cleanup();
43+
2644 #endif /* SXIV_H */