man: netsniff-ng: add documentation for option
[netsniff-ng.git] / die.h
blob95d133890082e83a5229d2baf306f17b92e14591
1 /*
2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2009, 2010 Daniel Borkmann.
4 * Subject to the GPL, version 2.
5 */
7 #ifndef DIE_H
8 #define DIE_H
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <stdarg.h>
13 #include <string.h>
14 #include <errno.h>
15 #include <unistd.h>
16 #include <syslog.h>
18 #include "built_in.h"
20 static inline void panic(const char *format, ...) __check_format_printf(1, 2);
21 static inline void syslog_panic(const char *format,
22 ...) __check_format_printf(1, 2);
23 static inline void syslog_maybe(int may, int priority,
24 const char *format, ...) __check_format_printf(3, 4);
26 static inline void die(void)
28 exit(EXIT_FAILURE);
31 static inline void _die(void)
33 _exit(EXIT_FAILURE);
36 static inline void panic(const char *format, ...)
38 va_list vl;
40 va_start(vl, format);
41 vfprintf(stderr, format, vl);
42 va_end(vl);
44 die();
47 static inline void syslog_panic(const char *format, ...)
49 va_list vl;
51 va_start(vl, format);
52 vsyslog(LOG_ERR, format, vl);
53 va_end(vl);
55 die();
58 static inline void syslog_maybe(int maybe, int priority, const char *format, ...)
60 if (!!maybe) {
61 va_list vl;
63 va_start(vl, format);
64 vsyslog(priority, format, vl);
65 va_end(vl);
69 #endif /* DIE_H */