aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/interestingtimes.c6
-rw-r--r--lib/lib.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/interestingtimes.c b/lib/interestingtimes.c
index 70fd4f9b..93e2ec52 100644
--- a/lib/interestingtimes.c
+++ b/lib/interestingtimes.c
@@ -110,6 +110,11 @@ int set_terminal(int fd, int raw, struct termios *old)
return tcsetattr(fd, TCSANOW, &termio);
}
+void xset_terminal(int fd, int raw, struct termios *old)
+{
+ if (-1 == set_terminal(fd, raw, old)) perror_exit("bad tty fd#%d", fd);
+}
+
struct scan_key_list {
char *name, *seq;
} static const scan_key_list[] = TAGGED_ARRAY(KEY,
@@ -225,6 +230,7 @@ void tty_reset(void)
fflush(0);
}
+// If you call set_terminal(), use sigatexit(tty_sigreset);
void tty_sigreset(int i)
{
tty_reset();
diff --git a/lib/lib.h b/lib/lib.h
index ade7c59b..a6998a86 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -224,6 +224,7 @@ int terminal_size(unsigned *xx, unsigned *yy);
int terminal_probesize(unsigned *xx, unsigned *yy);
int scan_key_getsize(char *scratch, int miliwait, unsigned *xx, unsigned *yy);
int set_terminal(int fd, int raw, struct termios *old);
+void xset_terminal(int fd, int raw, struct termios *old);
int scan_key(char *scratch, int miliwait);
void tty_esc(char *s);
void tty_jump(int x, int y);