diff options
author | Martin Willi <martin@revosec.ch> | 2015-04-15 16:20:29 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2015-04-16 14:50:04 +0200 |
commit | 7585a85f1ac81c6a39b968cbefebe22e87338f41 (patch) | |
tree | de797f3ad44c871a2602b825a8858a40254c2572 /src/libstrongswan/utils/utils.c | |
parent | 7802ab88a1afe5c6006896647984c0ed19bdf7cb (diff) | |
download | strongswan-7585a85f1ac81c6a39b968cbefebe22e87338f41.tar.bz2 strongswan-7585a85f1ac81c6a39b968cbefebe22e87338f41.tar.xz |
tty: Move tty related functions to separate files
Diffstat (limited to 'src/libstrongswan/utils/utils.c')
-rw-r--r-- | src/libstrongswan/utils/utils.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/libstrongswan/utils/utils.c b/src/libstrongswan/utils/utils.c index 497e0516e..5585f1457 100644 --- a/src/libstrongswan/utils/utils.c +++ b/src/libstrongswan/utils/utils.c @@ -322,73 +322,6 @@ bool mkdir_p(const char *path, mode_t mode) return TRUE; } -ENUM(tty_color_names, TTY_RESET, TTY_BG_DEF, - "\e[0m", - "\e[1m", - "\e[4m", - "\e[5m", - "\e[30m", - "\e[31m", - "\e[32m", - "\e[33m", - "\e[34m", - "\e[35m", - "\e[36m", - "\e[37m", - "\e[39m", - "\e[40m", - "\e[41m", - "\e[42m", - "\e[43m", - "\e[44m", - "\e[45m", - "\e[46m", - "\e[47m", - "\e[49m", -); - -/** - * Get the escape string for a given TTY color, empty string on non-tty FILE - */ -char* tty_escape_get(int fd, tty_escape_t escape) -{ - if (!isatty(fd)) - { - return ""; - } - switch (escape) - { - case TTY_RESET: - case TTY_BOLD: - case TTY_UNDERLINE: - case TTY_BLINKING: -#ifdef WIN32 - return ""; -#endif - case TTY_FG_BLACK: - case TTY_FG_RED: - case TTY_FG_GREEN: - case TTY_FG_YELLOW: - case TTY_FG_BLUE: - case TTY_FG_MAGENTA: - case TTY_FG_CYAN: - case TTY_FG_WHITE: - case TTY_FG_DEF: - case TTY_BG_BLACK: - case TTY_BG_RED: - case TTY_BG_GREEN: - case TTY_BG_YELLOW: - case TTY_BG_BLUE: - case TTY_BG_MAGENTA: - case TTY_BG_CYAN: - case TTY_BG_WHITE: - case TTY_BG_DEF: - return enum_to_name(tty_color_names, escape); - /* warn if a escape code is missing */ - } - return ""; -} - #ifndef HAVE_CLOSEFROM /** * Described in header. |