Make getch() read directly from stdin if stdin isn't a tty
Improve compile-time error handling
Handle EOF