xutils: Add common code to set up struct itimerval interval and value
[netsniff-ng.git] / tprintf.h
blob7085a211bf40ce7aadc0f948bfd097a849b4315f
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 TPRINTF_H
9 #define TPRINTF_H
11 #include "built_in.h"
13 #define DEFAULT_TTY_SIZE 80
15 extern void tprintf_init(void);
16 extern void tprintf(char *msg, ...) __check_format_printf(1, 2);
17 extern void tprintf_flush(void);
18 extern void tprintf_cleanup(void);
20 extern void tputchar_safe(int c);
21 extern void tputs_safe(const char *str, size_t len);
23 #define colorize_start(fore) "\033[" __##fore "m"
24 #define colorize_start_full(fore, back) "\033[" __##fore ";" __on_##back "m"
25 #define colorize_end() "\033[" __reset "m"
27 #define colorize_str(fore, text) colorize_start(fore) text colorize_end()
28 #define colorize_full_str(fore, back, text) colorize_start_full(fore, back) text colorize_end()
30 #define __reset "0"
32 #define __bold "1"
34 #define __black "30"
35 #define __red "31"
36 #define __green "32"
37 #define __yellow "33"
38 #define __blue "34"
39 #define __magenta "35"
40 #define __cyan "36"
41 #define __white "37"
43 #define __on_black "40"
44 #define __on_red "41"
45 #define __on_green "42"
46 #define __on_yellow "43"
47 #define __on_blue "44"
48 #define __on_magenta "45"
49 #define __on_cyan "46"
50 #define __on_white "47"
52 #endif /* TPRINTF_H */