diff options
author | John Hawthorn <john.hawthorn@gmail.com> | 2014-10-19 16:19:24 -0700 |
---|---|---|
committer | John Hawthorn <john.hawthorn@gmail.com> | 2014-10-19 16:19:24 -0700 |
commit | b44be63a562eba356495f066a7c6ef2c83866c2b (patch) | |
tree | da3e3ced8a811e3c5fead7868afedfb09b0674a3 /tty.c | |
parent | 3db8d503319723c8c1a2950fdcc04f7684c8aa82 (diff) |
termios should be reset on successful exit.
Still needs to be fixed on an exit due to ^C
Thanks @rtandy
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -12,6 +12,12 @@ void tty_reset(tty_t *tty){ tcsetattr(tty->fdin, TCSANOW, &tty->original_termios); } +void tty_close(tty_t *tty){ + tty_reset(tty); + fclose(tty->fout); + close(tty->fdin); +} + void tty_init(tty_t *tty, const char *tty_filename){ tty->fdin = open(tty_filename, O_RDONLY); tty->fout = fopen(tty_filename, "w"); |