- /*
- ** Are we changing the kill or erase character?
- */
- if (killp || erasep) {
-#ifdef HAVE_TERMIOS_H
- cc_t save_erase, save_kill;
-#else
- int save_erase, save_kill;
-#endif
-
- /* get the current terminal attributes */
-#ifdef HAVE_TERMIOS_H
- tcgetattr(0, &tio);
-#else
-# ifdef HAVE_TERMIO_H
- ioctl(0, TCGETA, &tio);
-# else
- ioctl(0, TIOCGETP, (char *) &tio);
- ioctl(0, TIOCGETC, (char *) &tc);
-# endif
-#endif
-
- /* save original kill, erase character for later */
- save_kill = KILL;
- save_erase = ERASE;
-
- /* set new kill, erase character in terminal structure */
- KILL = killp ? chrcnv(killp) : save_kill;
- ERASE = erasep ? chrcnv(erasep) : save_erase;
-
- /* set the new terminal attributes */
-#ifdef HAVE_TERMIOS_H
- tcsetattr(0, TCSADRAIN, &tio);
-#else
-# ifdef HAVE_TERMIO_H
- ioctl(0, TCSETAW, &tio);
-# else
- ioctl(0, TIOCSETN, (char *) &tio);
-# endif
-#endif
-
- /* print out new kill erase characters */
- chrdsp("erase", ERASE);
- chrdsp(", kill", KILL);
- chrdsp(", intr", INTR);
- putchar('\n');
- fflush(stdout);
-
- /*
- ** We set the kill and erase character back to original
- ** setup in terminal structure so we can easily
- ** restore it upon exit.
- */
- KILL = save_kill;
- ERASE = save_erase;
- }
-