Update with termios handling and poll() use.