X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Fbasic%2Fterminal-util.h;h=561045871eae411c6c877b6f828dc7d6f92b815a;hb=906f94da76802b2aae4dd052018766f5378ae4b8;hp=1366181449d7d2b10473c689683f2820a8e016dd;hpb=da2587d5154e11d4e643e326793f3ce2cc48dee6;p=elogind.git diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h index 136618144..561045871 100644 --- a/src/basic/terminal-util.h +++ b/src/basic/terminal-util.h @@ -19,9 +19,10 @@ along with systemd; If not, see . ***/ -#include #include +#include #include +#include #include "macro.h" #include "time-util.h" @@ -67,6 +68,7 @@ int vt_disallocate(const char *name); char *resolve_dev_console(char **active); #endif // 0 +int get_kernel_consoles(char ***consoles); bool tty_is_vc(const char *tty); #if 0 /// UNNEEDED by elogind bool tty_is_vc_resolve(const char *tty); @@ -92,46 +94,48 @@ void columns_lines_cache_reset(int _unused_ signum); #endif // 0 bool on_tty(void); +bool terminal_is_dumb(void); +bool colors_enabled(void); static inline const char *ansi_underline(void) { - return on_tty() ? ANSI_UNDERLINE : ""; + return colors_enabled() ? ANSI_UNDERLINE : ""; } static inline const char *ansi_highlight(void) { - return on_tty() ? ANSI_HIGHLIGHT : ""; + return colors_enabled() ? ANSI_HIGHLIGHT : ""; } static inline const char *ansi_highlight_underline(void) { - return on_tty() ? ANSI_HIGHLIGHT_UNDERLINE : ""; + return colors_enabled() ? ANSI_HIGHLIGHT_UNDERLINE : ""; } static inline const char *ansi_highlight_red(void) { - return on_tty() ? ANSI_HIGHLIGHT_RED : ""; + return colors_enabled() ? ANSI_HIGHLIGHT_RED : ""; } static inline const char *ansi_highlight_green(void) { - return on_tty() ? ANSI_HIGHLIGHT_GREEN : ""; + return colors_enabled() ? ANSI_HIGHLIGHT_GREEN : ""; } static inline const char *ansi_highlight_yellow(void) { - return on_tty() ? ANSI_HIGHLIGHT_YELLOW : ""; + return colors_enabled() ? ANSI_HIGHLIGHT_YELLOW : ""; } static inline const char *ansi_highlight_blue(void) { - return on_tty() ? ANSI_HIGHLIGHT_BLUE : ""; + return colors_enabled() ? ANSI_HIGHLIGHT_BLUE : ""; } static inline const char *ansi_normal(void) { - return on_tty() ? ANSI_NORMAL : ""; + return colors_enabled() ? ANSI_NORMAL : ""; } int get_ctty_devnr(pid_t pid, dev_t *d); int get_ctty(pid_t, dev_t *_devnr, char **r); -#if 0 /// UNNEEDED by elogind int getttyname_malloc(int fd, char **r); int getttyname_harder(int fd, char **r); +#if 0 /// UNNEEDED by elogind int ptsname_malloc(int fd, char **ret); int ptsname_namespace(int pty, char **ret);