-/* Returns the user\'s terminal to normal mode if it had been put in raw mode. */
-
-void
-leave_raw_mode(void)
-{
- if (!in_raw_mode)
- return;
- in_raw_mode = 0;
- if (tcsetattr(fileno(stdin), TCSADRAIN, &saved_tio) < 0)
- perror("tcsetattr");
-
- fatal_remove_cleanup((void (*) (void *)) leave_raw_mode, NULL);
-}
-
-/* Puts the user\'s terminal in raw mode. */
-
-void
-enter_raw_mode(void)
-{
- struct termios tio;
-
- if (tcgetattr(fileno(stdin), &tio) < 0)
- perror("tcgetattr");
- saved_tio = tio;
- tio.c_iflag |= IGNPAR;
- tio.c_iflag &= ~(ISTRIP | INLCR | IGNCR | ICRNL | IXON | IXANY | IXOFF);
- tio.c_lflag &= ~(ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHONL);
-#ifdef IEXTEN
- tio.c_lflag &= ~IEXTEN;
-#endif /* IEXTEN */
- tio.c_oflag &= ~OPOST;
- tio.c_cc[VMIN] = 1;
- tio.c_cc[VTIME] = 0;
- if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) < 0)
- perror("tcsetattr");
- in_raw_mode = 1;
-
- fatal_add_cleanup((void (*) (void *)) leave_raw_mode, NULL);
-}
-