]> git.ipfire.org Git - people/ms/strongswan.git/blob - src/libstrongswan/utils/utils/tty.h
tty: Move tty related functions to separate files
[people/ms/strongswan.git] / src / libstrongswan / utils / utils / tty.h
1 /*
2 * Copyright (C) 2008-2014 Tobias Brunner
3 * Copyright (C) 2008 Martin Willi
4 * Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 /**
18 * @defgroup tty_i tty
19 * @{ @ingroup utils_i
20 */
21
22 #ifndef TTY_H_
23 #define TTY_H_
24
25 typedef enum tty_escape_t tty_escape_t;
26
27 /**
28 * Excape codes for tty colors
29 */
30 enum tty_escape_t {
31 /** text properties */
32 TTY_RESET,
33 TTY_BOLD,
34 TTY_UNDERLINE,
35 TTY_BLINKING,
36
37 /** foreground colors */
38 TTY_FG_BLACK,
39 TTY_FG_RED,
40 TTY_FG_GREEN,
41 TTY_FG_YELLOW,
42 TTY_FG_BLUE,
43 TTY_FG_MAGENTA,
44 TTY_FG_CYAN,
45 TTY_FG_WHITE,
46 TTY_FG_DEF,
47
48 /** background colors */
49 TTY_BG_BLACK,
50 TTY_BG_RED,
51 TTY_BG_GREEN,
52 TTY_BG_YELLOW,
53 TTY_BG_BLUE,
54 TTY_BG_MAGENTA,
55 TTY_BG_CYAN,
56 TTY_BG_WHITE,
57 TTY_BG_DEF,
58 };
59
60 /**
61 * Get the escape string for a given TTY color, empty string on non-tty fd
62 */
63 char* tty_escape_get(int fd, tty_escape_t escape);
64
65 #endif /** TTY_H_ @} */