proto_ip_authentication_hdr.h:Usable with pkt_buff
[netsniff-ng.git] / src / die.h
blob7160e49f09a3835c099e2785cabc11a041dda0b1
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 *format, ...)
31 va_list vl;
32 va_start(vl, format);
33 vfprintf(stderr, format, vl);
34 va_end(vl);
35 die();
38 static inline void syslog_panic(const char *format, ...)
40 va_list vl;
41 va_start(vl, format);
42 vsyslog(LOG_ERR, format, vl);
43 va_end(vl);
44 die();
47 static inline void syslog_maybe(int may, int priority, const char *format, ...)
49 if (may) {
50 va_list vl;
51 va_start(vl, format);
52 vsyslog(priority, format, vl);
53 va_end(vl);
57 static inline void whine(char *format, ...)
59 va_list vl;
60 va_start(vl, format);
61 vfprintf(stderr, format, vl);
62 va_end(vl);
65 #endif /* DIE_H */