terminal-util: rename set_terminal_cursor_position() → terminal_set_cursor_position()

Let's prefix these functions with the subsystem name, and clean them up
a bit. Specifically, drop the error logging, it's entirely duplicative,
since every single caller does it anyway.
This commit is contained in:
Lennart Poettering
2024-07-19 11:41:43 +02:00
parent 445e57387e
commit 53f0ab5151
4 changed files with 13 additions and 18 deletions
+3 -9
View File
@@ -1522,19 +1522,13 @@ void get_log_colors(int priority, const char **on, const char **off, const char
}
}
int set_terminal_cursor_position(int fd, unsigned int row, unsigned int column) {
int r;
char cursor_position[STRLEN("\x1B[") + DECIMAL_STR_MAX(int) * 2 + STRLEN(";H") + 1];
int terminal_set_cursor_position(int fd, unsigned row, unsigned column) {
assert(fd >= 0);
char cursor_position[STRLEN("\x1B[" ";" "H") + DECIMAL_STR_MAX(unsigned) * 2 + 1];
xsprintf(cursor_position, "\x1B[%u;%uH", row, column);
r = loop_write(fd, cursor_position, SIZE_MAX);
if (r < 0)
return log_warning_errno(r, "Failed to set cursor position, ignoring: %m");
return 0;
return loop_write(fd, cursor_position, SIZE_MAX);
}
int terminal_reset_ansi_seq(int fd) {
+2 -1
View File
@@ -97,9 +97,10 @@ bool isatty_safe(int fd);
int reset_terminal_fd(int fd, bool switch_to_text);
int reset_terminal(const char *name);
int set_terminal_cursor_position(int fd, unsigned int row, unsigned int column);
int terminal_reset_ansi_seq(int fd);
int terminal_set_cursor_position(int fd, unsigned row, unsigned column);
int open_terminal(const char *name, int mode);
/* Flags for tweaking the way we become the controlling process of a terminal. */