void term_cleanup(void)
{
+ term_clear();
+ term_setcursor(0, 0);
+ term_flush();
tcsetattr(ttyfd, TCSAFLUSH, &saved_term);
close(ttyfd);
ttyfd = -1;
}
+void term_reset(void)
+{
+ term_puts("\033c");
+ term_flush();
+}
+
void term_getsize(int *width, int *height)
{
*width = term_width;
}
}
+void term_putchar(char c)
+{
+ term_send(&c, 1);
+}
+
void term_puts(const char *s)
{
term_send(s, strlen(s));
term_puts("\033[2J");
}
+void term_cursor(int show)
+{
+ term_printf("\033[?25%c", show ? 'h' : 'l');
+}
+
+void term_setcursor(int row, int col)
+{
+ term_printf("\033[%d;%dH", row + 1, col + 1);
+}
+
int term_getchar(void)
{
int res;