diff options
author | John Hawthorn <john.hawthorn@gmail.com> | 2014-09-16 19:00:09 -0700 |
---|---|---|
committer | John Hawthorn <john.hawthorn@gmail.com> | 2014-09-16 19:00:09 -0700 |
commit | 28980ca3281d4c7ee81bf13e1082b7e27c83bd39 (patch) | |
tree | 507009efb1e9e4054147699194f1a638a17dc6fc /tty.c | |
parent | 4e5bca0b15ae58757d1d294b1ae8dbd9cce67ccc (diff) |
Abort on any tty errors
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -16,9 +16,11 @@ void tty_reset(tty_t *tty){ void tty_init(tty_t *tty, const char *tty_filename){ tty->fdin = open(tty_filename, O_RDONLY); tty->fout = fopen(tty_filename, "w"); - setvbuf(tty->fout, NULL, _IOFBF, 4096); + if(setvbuf(tty->fout, NULL, _IOFBF, 4096)) + perror("setvbuf"); - tcgetattr(tty->fdin, &tty->original_termios); + if(tcgetattr(tty->fdin, &tty->original_termios)) + perror("tcgetattr"); struct termios new_termios = tty->original_termios; @@ -29,7 +31,8 @@ void tty_init(tty_t *tty, const char *tty_filename){ */ new_termios.c_lflag &= ~(ICANON | ECHO); - tcsetattr(tty->fdin, TCSANOW, &new_termios); + if(tcsetattr(tty->fdin, TCSANOW, &new_termios)) + perror("tcsetattr"); tty_getwinsz(tty); |