aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-01-10 15:59:09 -0600
committerRob Landley <rob@landley.net>2016-01-10 15:59:09 -0600
commit1b983744cde6819fe1d810e98cfac52585ceacaf (patch)
treeb9ace7b8fd5de7183717a5ea4fc92001700b16c8 /lib
parent8784d8d968c72328db11a72d50c836fc1650fa9a (diff)
downloadtoybox-1b983744cde6819fe1d810e98cfac52585ceacaf.tar.gz
Make cursor left/right change sort type in iotop.
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);