diff options
author | Mike Yuan <me@yhndnzj.com> | 2025-01-02 16:12:35 +0100 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2025-01-02 20:42:20 +0100 |
commit | 217bd588c2c0edd4a390d48e3fef07882fc714a8 (patch) | |
tree | 3be93b909a14851317098941118c897919836a17 /src/basic/terminal-util.h | |
parent | shared/hibernate-util: handle the case where no swap has available backing de... (diff) | |
download | systemd-217bd588c2c0edd4a390d48e3fef07882fc714a8.tar.xz systemd-217bd588c2c0edd4a390d48e3fef07882fc714a8.zip |
terminal-util: regroup some functions
Diffstat (limited to '')
-rw-r--r-- | src/basic/terminal-util.h | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h index fc7a22e6a5..6433c06907 100644 --- a/src/basic/terminal-util.h +++ b/src/basic/terminal-util.h @@ -64,19 +64,6 @@ typedef enum AcquireTerminalFlags { int acquire_terminal(const char *name, AcquireTerminalFlags flags, usec_t timeout); int release_terminal(void); -/* Limits the use of ANSI colors to a subset. */ -typedef enum ColorMode { - COLOR_OFF, /* No colors, monochrome output. */ - COLOR_16, /* Only the base 16 colors. */ - COLOR_256, /* Only 256 colors. */ - COLOR_24BIT, /* For truecolor or 24bit color support, no restriction. */ - _COLOR_MODE_MAX, - _COLOR_MODE_INVALID = -EINVAL, -} ColorMode; - -const char* color_mode_to_string(ColorMode m) _const_; -ColorMode color_mode_from_string(const char *s) _pure_; - int terminal_vhangup_fd(int fd); int terminal_vhangup(const char *tty); @@ -117,15 +104,29 @@ void reset_terminal_feature_caches(void); bool on_tty(void); bool getenv_terminal_is_dumb(void); bool terminal_is_dumb(void); -ColorMode get_color_mode(void); -bool underline_enabled(void); -bool dev_console_colors_enabled(void); +/* Limits the use of ANSI colors to a subset. */ +typedef enum ColorMode { + COLOR_OFF, /* No colors, monochrome output. */ + COLOR_16, /* Only the base 16 colors. */ + COLOR_256, /* Only 256 colors. */ + COLOR_24BIT, /* For truecolor or 24bit color support, no restriction. */ + _COLOR_MODE_MAX, + _COLOR_MODE_INVALID = -EINVAL, +} ColorMode; + +const char* color_mode_to_string(ColorMode m) _const_; +ColorMode color_mode_from_string(const char *s) _pure_; + +ColorMode get_color_mode(void); static inline bool colors_enabled(void) { /* Returns true if colors are considered supported on our stdout. */ return get_color_mode() != COLOR_OFF; } +bool underline_enabled(void); +bool dev_console_colors_enabled(void); + int get_ctty_devnr(pid_t pid, dev_t *ret); int get_ctty(pid_t, dev_t *ret_devnr, char **ret); |