-int
-save_tty_settings(TTY * tty_settings)
-{
- if (!get_tty_settings(STDERR_FILENO, tty_settings) &&
- !get_tty_settings(STDOUT_FILENO, tty_settings) &&
- !get_tty_settings(STDIN_FILENO, tty_settings) &&
- !get_tty_settings(open("/dev/tty", O_RDWR), tty_settings)) {
- failed("terminal attributes");
- }
- can_restore = TRUE;
- original_settings = *tty_settings;
- return my_fd;
-}
-
-void
-restore_tty_settings(void)
-{
- if (can_restore)
- SET_TTY(my_fd, &original_settings);
-}
-
-/* Set the modes if they've changed. */
-void
-update_tty_settings(TTY * old_settings, TTY * new_settings)
-{
- if (memcmp(new_settings, old_settings, sizeof(TTY))) {
- SET_TTY(my_fd, new_settings);
- }
-}
-
-#if HAVE_SIZECHANGE
-/* Set window size if not set already */