pull isatty checks out into a global variable
make orig_termios and raw_termios global variables
extract termios init code into its own function
extract mode switching code into raw_{on,off}
turn off raw mode before printing error messages
try to re-open the tty the first time it returns EIO
remove signal handling
handle EINTR
add an escape key
document escape mode