Added jack plugs into netyack
[transsip-mirror.git] / src / die.h
blob46fb57ec9a70016a3fa2c2564eaef84b87e427a1
1 /*
2 * netyack
3 * By Daniel Borkmann <daniel@netyack.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>
17 static inline void error_and_die(int status, char *msg, ...)
19 va_list vl;
20 va_start(vl, msg);
21 vfprintf(stderr, msg, vl);
22 va_end(vl);
23 exit(status);
26 static inline void die(void)
28 exit(EXIT_FAILURE);
31 static inline void panic(char *msg, ...)
33 va_list vl;
34 va_start(vl, msg);
35 vfprintf(stderr, msg, vl);
36 va_end(vl);
37 die();
40 static inline void whine(char *msg, ...)
42 va_list vl;
43 va_start(vl, msg);
44 vfprintf(stderr, msg, vl);
45 va_end(vl);
48 static inline void info(char *msg, ...)
50 va_list vl;
51 va_start(vl, msg);
52 vfprintf(stdout, msg, vl);
53 va_end(vl);
56 #ifdef _DEBUG_
57 static inline void debug(char *msg, ...)
59 va_list vl;
60 va_start(vl, msg);
61 vfprintf(stderr, msg, vl);
62 va_end(vl);
64 fflush(stderr);
66 #else
67 static inline void debug(char *msg, ...)
69 /* NOP */
71 #endif /* _DEBUG_ */
72 #endif /* DIE_H */