From b61c015aeb5b0abddca3a8ce2a8b0d7c58433b3f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 11 Jul 2024 10:47:01 +0200 Subject: [PATCH] terminal-util: don't export vt_reset_keyboard() + vt_default_utf8() --- src/basic/terminal-util.c | 44 +++++++++++++++++++-------------------- src/basic/terminal-util.h | 2 -- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index 0c886afc05a..60dcdb97128 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -498,6 +498,28 @@ int vt_disallocate(const char *name) { return 0; } +static int vt_default_utf8(void) { + _cleanup_free_ char *b = NULL; + int r; + + /* Read the default VT UTF8 setting from the kernel */ + + r = read_one_line_file("/sys/module/vt/parameters/default_utf8", &b); + if (r < 0) + return r; + + return parse_boolean(b); +} + +static int vt_reset_keyboard(int fd) { + int kb; + + /* If we can't read the default, then default to unicode. It's 2017 after all. */ + kb = vt_default_utf8() != 0 ? K_UNICODE : K_XLATE; + + return RET_NERRNO(ioctl(fd, KDSKBMODE, kb)); +} + static int terminal_reset_ioctl(int fd, bool switch_to_text) { struct termios termios; int r; @@ -1439,28 +1461,6 @@ bool underline_enabled(void) { return cached_underline_enabled; } -int vt_default_utf8(void) { - _cleanup_free_ char *b = NULL; - int r; - - /* Read the default VT UTF8 setting from the kernel */ - - r = read_one_line_file("/sys/module/vt/parameters/default_utf8", &b); - if (r < 0) - return r; - - return parse_boolean(b); -} - -int vt_reset_keyboard(int fd) { - int kb; - - /* If we can't read the default, then default to unicode. It's 2017 after all. */ - kb = vt_default_utf8() != 0 ? K_UNICODE : K_XLATE; - - return RET_NERRNO(ioctl(fd, KDSKBMODE, kb)); -} - int vt_restore(int fd) { static const struct vt_mode mode = { diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h index aec08e1942e..8b55ade765a 100644 --- a/src/basic/terminal-util.h +++ b/src/basic/terminal-util.h @@ -277,8 +277,6 @@ int openpt_allocate(int flags, char **ret_slave); int openpt_allocate_in_namespace(pid_t pid, int flags, char **ret_slave); int open_terminal_in_namespace(pid_t pid, const char *name, int mode); -int vt_default_utf8(void); -int vt_reset_keyboard(int fd); int vt_restore(int fd); int vt_release(int fd, bool restore_vt);