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:
@@ -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) {
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user