die: removed info(), since gcc can throw compile warnings with printf, not with info
[netsniff-ng.git] / src / die.h
blob2e6720b4f799fa15e9f277657782252301dc8e3a
1 /*
2 * netsniff-ng - the packet sniffing beast
3 * By Daniel Borkmann <daniel@netsniff-ng.org>
4 * Copyright 2009, 2010 Daniel Borkmann.
5 * Subject to the GPL, version 2.
6 */
8 #ifndef DIE_H
9 #define DIE_H
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <stdarg.h>
14 #include <string.h>
15 #include <errno.h>
16 #include <unistd.h>
17 #include <syslog.h>
19 static inline void die(void)
21 exit(EXIT_FAILURE);
24 static inline void _die(void)
26 _exit(EXIT_FAILURE);
29 static inline void panic(char *msg, ...)
31 va_list vl;
32 va_start(vl, msg);
33 vfprintf(stderr, msg, vl);
34 va_end(vl);
35 die();
38 #define syslog_panic(msg...) \
39 do { \
40 syslog(LOG_ERR, ##msg); \
41 die(); \
42 } while (0)
44 static inline void whine(char *msg, ...)
46 va_list vl;
47 va_start(vl, msg);
48 vfprintf(stderr, msg, vl);
49 va_end(vl);
52 #endif /* DIE_H */