]> wirehaze git hosting - graph-theory.git/blob - lib/dbg.h

wirehaze git hosting

422c681e40bd6138f9d163fc1c6e91687cc4c44c
[graph-theory.git] / lib / dbg.h
1 #ifndef DBG_H
2 #define DBG_H
3
4 #include <errno.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8
9 #define dbg(...) fprintf (stderr, __VA_ARGS__)
10
11 #define fatal(x) \
12 do \
13 { \
14 fprintf (stderr, "(%s:%d) %s () failed: %s errno: %s\n", __FILE__, \
15 __LINE__, __func__, x, strerror (errno)); \
16 exit (EXIT_FAILURE); \
17 } \
18 while (0)
19
20 #endif /* DBG_H */