home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / debug / gdb / readline / rltty.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  15.6 KB  |  672 lines

  1. /* rltty.c -- functions to prepare and restore the terminal for readline's
  2.    use. */
  3.  
  4. /* Copyright (C) 1992 Free Software Foundation, Inc.
  5.  
  6.    This file is part of the GNU Readline Library, a library for
  7.    reading lines of text with interactive input and history editing.
  8.  
  9.    The GNU Readline Library is free software; you can redistribute it
  10.    and/or modify it under the terms of the GNU General Public License
  11.    as published by the Free Software Foundation; either version 1, or
  12.    (at your option) any later version.
  13.  
  14.    The GNU Readline Library is distributed in the hope that it will be
  15.    useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  16.    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.    GNU General Public License for more details.
  18.  
  19.    The GNU General Public License is often shipped with GNU software, and
  20.    is generally kept in a file called COPYING or LICENSE.  If you do not
  21.    have a copy of the license, write to the Free Software Foundation,
  22.    675 Mass Ave, Cambridge, MA 02139, USA. */
  23. #include "sysdep.h"
  24. #include <signal.h>
  25. #include <errno.h>
  26. #include <stdio.h>
  27. #ifndef    NO_SYS_FILE
  28. #include <sys/file.h>
  29. #endif
  30.  
  31. #if defined (HAVE_UNISTD_H)
  32. #  include <unistd.h>
  33. #endif /* HAVE_UNISTD_H */
  34.  
  35. #include "rldefs.h"
  36. #include "readline.h"
  37.  
  38. #if !defined (errno)
  39. extern int errno;
  40. #endif /* !errno */
  41.  
  42. extern int readline_echoing_p;
  43. extern int _rl_eof_char;
  44.  
  45. #if defined (__GO32__)
  46. #  include <sys/pc.h>
  47. #  undef HANDLE_SIGNALS
  48. #endif /* __GO32__ */
  49.  
  50. /* **************************************************************** */
  51. /*                                    */
  52. /*               Signal Management                */
  53. /*                                    */
  54. /* **************************************************************** */
  55.  
  56. #if defined (HAVE_POSIX_SIGNALS)
  57. static sigset_t sigint_set, sigint_oset;
  58. #else /* !HAVE_POSIX_SIGNALS */
  59. #  if defined (HAVE_BSD_SIGNALS)
  60. static int sigint_oldmask;
  61. #  endif /* HAVE_BSD_SIGNALS */
  62. #endif /* !HAVE_POSIX_SIGNALS */
  63.  
  64. static int sigint_blocked = 0;
  65.  
  66. /* Cause SIGINT to not be delivered until the corresponding call to
  67.    release_sigint(). */
  68. static void
  69. block_sigint ()
  70. {
  71.   if (sigint_blocked)
  72.     return;
  73.  
  74. #if defined (HAVE_POSIX_SIGNALS)
  75.   sigemptyset (&sigint_set);
  76.   sigemptyset (&sigint_oset);
  77.   sigaddset (&sigint_set, SIGINT);
  78.   sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset);
  79. #else /* !HAVE_POSIX_SIGNALS */
  80. #  if defined (HAVE_BSD_SIGNALS)
  81.   sigint_oldmask = sigblock (sigmask (SIGINT));
  82. #  else /* !HAVE_BSD_SIGNALS */
  83. #    if defined (HAVE_USG_SIGHOLD)
  84.   sighold (SIGINT);
  85. #    endif /* HAVE_USG_SIGHOLD */
  86. #  endif /* !HAVE_BSD_SIGNALS */
  87. #endif /* !HAVE_POSIX_SIGNALS */
  88.   sigint_blocked = 1;
  89. }
  90.  
  91. /* Allow SIGINT to be delivered. */
  92. static void
  93. release_sigint ()
  94. {
  95.   if (!sigint_blocked)
  96.     return;
  97.  
  98. #if defined (HAVE_POSIX_SIGNALS)
  99.   sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
  100. #else
  101. #  if defined (HAVE_BSD_SIGNALS)
  102.   sigsetmask (sigint_oldmask);
  103. #  else /* !HAVE_BSD_SIGNALS */
  104. #    if defined (HAVE_USG_SIGHOLD)
  105.   sigrelse (SIGINT);
  106. #    endif /* HAVE_USG_SIGHOLD */
  107. #  endif /* !HAVE_BSD_SIGNALS */
  108. #endif /* !HAVE_POSIX_SIGNALS */
  109.  
  110.   sigint_blocked = 0;
  111. }
  112.  
  113. /* **************************************************************** */
  114. /*                                    */
  115. /*              Controlling the Meta Key                */
  116. /*                                    */
  117. /* **************************************************************** */
  118.  
  119. extern int term_has_meta;
  120. extern char *term_mm;
  121. extern char *term_mo;
  122.  
  123. static void
  124. outchar (c)
  125.      int c;
  126. {
  127.   putc (c, rl_outstream);
  128. }
  129.  
  130. /* Turn on/off the meta key depending on ON. */
  131. #if !defined (MINIMAL)
  132. static void
  133. control_meta_key (on)
  134.      int on;
  135. {
  136.   if (term_has_meta)
  137.     {
  138.       if (on && term_mm)
  139.     tputs (term_mm, 1, outchar);
  140.       else if (!on && term_mo)
  141.     tputs (term_mo, 1, outchar);
  142.     }
  143. }
  144. #endif /* !MINIMAL */
  145.  
  146. /* **************************************************************** */
  147. /*                                    */
  148. /*              Saving and Restoring the TTY                */
  149. /*                                    */
  150. /* **************************************************************** */
  151.  
  152. /* Non-zero means that the terminal is in a prepped state. */
  153. static int terminal_prepped = 0;
  154.  
  155. /* If non-zero, means that this process has called tcflow(fd, TCOOFF)
  156.    and output is suspended. */
  157. #if defined (__ksr1__)
  158. static int ksrflow = 0;
  159. #endif
  160. #if defined (NEW_TTY_DRIVER)
  161.  
  162. /* Values for the `flags' field of a struct bsdtty.  This tells which
  163.    elements of the struct bsdtty have been fetched from the system and
  164.    are valid. */
  165. #define SGTTY_SET    0x01
  166. #define LFLAG_SET    0x02
  167. #define TCHARS_SET    0x04
  168. #define LTCHARS_SET    0x08
  169.  
  170. struct bsdtty {
  171.   struct sgttyb sgttyb;    /* Basic BSD tty driver information. */
  172.   int lflag;        /* Local mode flags, like LPASS8. */
  173. #if defined (TIOCGETC)
  174.   struct tchars tchars;    /* Terminal special characters, including ^S and ^Q. */
  175. #endif
  176. #if defined (TIOCGLTC)
  177.   struct ltchars ltchars; /* 4.2 BSD editing characters */
  178. #endif
  179.   int flags;        /* Bitmap saying which parts of the struct are valid. */
  180. };
  181.  
  182. #define TIOTYPE struct bsdtty
  183.  
  184. static TIOTYPE otio;
  185.  
  186. static int
  187. get_tty_settings (tty, tiop)
  188.      int tty;
  189.      TIOTYPE *tiop;
  190. {
  191.   tiop->flags = tiop->lflag = 0;
  192.  
  193.   ioctl (tty, TIOCGETP, &(tiop->sgttyb));
  194.   tiop->flags |= SGTTY_SET;
  195.  
  196. #if defined (TIOCLGET)
  197.   ioctl (tty, TIOCLGET, &(tiop->lflag));
  198.   tiop->flags |= LFLAG_SET;
  199. #endif
  200.  
  201. #if defined (TIOCGETC)
  202.   ioctl (tty, TIOCGETC, &(tiop->tchars));
  203.   tiop->flags |= TCHARS_SET;
  204. #endif
  205.  
  206. #if defined (TIOCGLTC)
  207.   ioctl (tty, TIOCGLTC, &(tiop->ltchars));
  208.   tiop->flags |= LTCHARS_SET;
  209. #endif
  210.  
  211.   return 0;
  212. }
  213.  
  214. set_tty_settings (tty, tiop)
  215.      int tty;
  216.      TIOTYPE *tiop;
  217. {
  218.   if (tiop->flags & SGTTY_SET)
  219.     {
  220.       ioctl (tty, TIOCSETN, &(tiop->sgttyb));
  221.       tiop->flags &= ~SGTTY_SET;
  222.     }
  223.  
  224. #if defined (TIOCLSET)
  225.   if (tiop->flags & LFLAG_SET)
  226.     {
  227.       ioctl (tty, TIOCLSET, &(tiop->lflag));
  228.       tiop->flags &= ~LFLAG_SET;
  229.     }
  230. #endif
  231.  
  232. #if defined (TIOCSETC)
  233.   if (tiop->flags & TCHARS_SET)
  234.     {
  235.       ioctl (tty, TIOCSETC, &(tiop->tchars));
  236.       tiop->flags &= ~TCHARS_SET;
  237.     }
  238. #endif
  239.  
  240. #if defined (TIOCSLTC)
  241.   if (tiop->flags & LTCHARS_SET)
  242.     {
  243.       ioctl (tty, TIOCSLTC, &(tiop->ltchars));
  244.       tiop->flags &= ~LTCHARS_SET;
  245.     }
  246. #endif
  247.  
  248.   return 0;
  249. }
  250.  
  251. static void
  252. prepare_terminal_settings (meta_flag, otio, tiop)
  253.      int meta_flag;
  254.      TIOTYPE otio, *tiop;
  255. {
  256. #if !defined (MINIMAL)
  257.   readline_echoing_p = (otio.sgttyb.sg_flags & ECHO);
  258.  
  259.   /* Copy the original settings to the structure we're going to use for
  260.      our settings. */
  261.   tiop->sgttyb = otio.sgttyb;
  262.   tiop->lflag = otio.lflag;
  263. #if defined (TIOCGETC)
  264.   tiop->tchars = otio.tchars;
  265. #endif
  266. #if defined (TIOCGLTC)
  267.   tiop->ltchars = otio.ltchars;
  268. #endif
  269.   tiop->flags = otio.flags;
  270.  
  271.   /* First, the basic settings to put us into character-at-a-time, no-echo
  272.      input mode. */
  273.   tiop->sgttyb.sg_flags &= ~(ECHO | CRMOD);
  274.   tiop->sgttyb.sg_flags |= CBREAK;
  275.  
  276.   /* If this terminal doesn't care how the 8th bit is used, then we can
  277.      use it for the meta-key.  If only one of even or odd parity is
  278.      specified, then the terminal is using parity, and we cannot. */
  279. #if !defined (ANYP)
  280. #  define ANYP (EVENP | ODDP)
  281. #endif
  282.   if (((otio.sgttyb.sg_flags & ANYP) == ANYP) ||
  283.       ((otio.sgttyb.sg_flags & ANYP) == 0))
  284.     {
  285.       tiop->sgttyb.sg_flags |= ANYP;
  286.  
  287.       /* Hack on local mode flags if we can. */
  288. #if defined (TIOCLGET)
  289. #  if defined (LPASS8)
  290.       tiop->lflag |= LPASS8;
  291. #  endif /* LPASS8 */
  292. #endif /* TIOCLGET */
  293.     }
  294.  
  295. #if defined (TIOCGETC)
  296. #  if defined (USE_XON_XOFF)
  297.   /* Get rid of terminal output start and stop characters. */
  298.   tiop->tchars.t_stopc = -1; /* C-s */
  299.   tiop->tchars.t_startc = -1; /* C-q */
  300.  
  301.   /* If there is an XON character, bind it to restart the output. */
  302.   if (otio.tchars.t_startc != -1)
  303.     rl_bind_key (otio.tchars.t_startc, rl_restart_output);
  304. #  endif /* USE_XON_XOFF */
  305.  
  306.   /* If there is an EOF char, bind _rl_eof_char to it. */
  307.   if (otio.tchars.t_eofc != -1)
  308.     _rl_eof_char = otio.tchars.t_eofc;
  309.  
  310. #  if defined (NO_KILL_INTR)
  311.   /* Get rid of terminal-generated SIGQUIT and SIGINT. */
  312.   tiop->tchars.t_quitc = -1; /* C-\ */
  313.   tiop->tchars.t_intrc = -1; /* C-c */
  314. #  endif /* NO_KILL_INTR */
  315. #endif /* TIOCGETC */
  316.  
  317. #if defined (TIOCGLTC)
  318.   /* Make the interrupt keys go away.  Just enough to make people happy. */
  319.   tiop->ltchars.t_dsuspc = -1;    /* C-y */
  320.   tiop->ltchars.t_lnextc = -1;    /* C-v */
  321. #endif /* TIOCGLTC */
  322. #endif /* !MINIMAL */
  323. }
  324. #endif /* defined (NEW_TTY_DRIVER) */
  325.  
  326. #if !defined (NEW_TTY_DRIVER) && !defined(MINIMAL)
  327.  
  328. #if !defined (VMIN)
  329. #  define VMIN VEOF
  330. #endif
  331.  
  332. #if !defined (VTIME)
  333. #  define VTIME VEOL
  334. #endif
  335.  
  336. #if defined (TERMIOS_TTY_DRIVER)
  337. #  define TIOTYPE struct termios
  338. #  define DRAIN_OUTPUT(fd)    tcdrain (fd)
  339. #  define GETATTR(tty, tiop)    (tcgetattr (tty, tiop))
  340. #  define SETATTR(tty, tiop)    (tcsetattr (tty, TCSANOW, tiop))
  341. #else
  342. #  define TIOTYPE struct termio
  343. #  define DRAIN_OUTPUT(fd)
  344. #  define GETATTR(tty, tiop)    (ioctl (tty, TCGETA, tiop))
  345. #  define SETATTR(tty, tiop)    (ioctl (tty, TCSETA, tiop))
  346. #endif /* !TERMIOS_TTY_DRIVER */
  347.  
  348. static TIOTYPE otio;
  349.  
  350. static int
  351. get_tty_settings (tty, tiop)
  352.      int tty;
  353.      TIOTYPE *tiop;
  354. {
  355.   while (GETATTR (tty, tiop) < 0)
  356.     {
  357.       if (errno != EINTR)
  358.     return -1;
  359.       errno = 0;
  360.     }
  361.   return 0;
  362. }
  363.  
  364. static int
  365. set_tty_settings (tty, tiop)
  366.      int tty;
  367.      TIOTYPE *tiop;
  368. {
  369.   while (SETATTR (tty, tiop) < 0)
  370.     {
  371.       if (errno != EINTR)
  372.     return -1;
  373.       errno = 0;
  374.     }
  375.  
  376. #if 0
  377.  
  378. #if defined (TERMIOS_TTY_DRIVER)
  379. #  if defined (__ksr1__)
  380.   if (ksrflow)
  381.     {
  382.       ksrflow = 0;
  383.       tcflow (tty, TCOON);
  384.     }
  385. #  else /* !ksr1 */
  386.   tcflow (tty, TCOON);        /* Simulate a ^Q. */
  387. #  endif /* !ksr1 */
  388. #else
  389.   ioctl (tty, TCXONC, 1);    /* Simulate a ^Q. */
  390. #endif /* !TERMIOS_TTY_DRIVER */
  391.  
  392. #endif
  393.  
  394.   return 0;
  395. }
  396.  
  397. static void
  398. prepare_terminal_settings (meta_flag, otio, tiop)
  399.      int meta_flag;
  400.      TIOTYPE otio, *tiop;
  401. {
  402.   readline_echoing_p = (otio.c_lflag & ECHO);
  403.  
  404.   tiop->c_lflag &= ~(ICANON | ECHO);
  405.  
  406.   if ((unsigned char) otio.c_cc[VEOF] != (unsigned char) _POSIX_VDISABLE)
  407.     _rl_eof_char = otio.c_cc[VEOF];
  408.  
  409. #if defined (USE_XON_XOFF)
  410. #if defined (IXANY)
  411.   tiop->c_iflag &= ~(IXON | IXOFF | IXANY);
  412. #else
  413.   /* `strict' Posix systems do not define IXANY. */
  414.   tiop->c_iflag &= ~(IXON | IXOFF);
  415. #endif /* IXANY */
  416. #endif /* USE_XON_XOFF */
  417.  
  418.   /* Only turn this off if we are using all 8 bits. */
  419.   if (((tiop->c_cflag & CSIZE) == CS8) || meta_flag)
  420.     tiop->c_iflag &= ~(ISTRIP | INPCK);
  421.  
  422.   /* Make sure we differentiate between CR and NL on input. */
  423.   tiop->c_iflag &= ~(ICRNL | INLCR);
  424.  
  425. #if !defined (HANDLE_SIGNALS)
  426.   tiop->c_lflag &= ~ISIG;
  427. #else
  428.   tiop->c_lflag |= ISIG;
  429. #endif
  430.  
  431.   tiop->c_cc[VMIN] = 1;
  432.   tiop->c_cc[VTIME] = 0;
  433.  
  434.   /* Turn off characters that we need on Posix systems with job control,
  435.      just to be sure.  This includes ^Y and ^V.  This should not really
  436.      be necessary.  */
  437. #if defined (TERMIOS_TTY_DRIVER) && defined (_POSIX_VDISABLE)
  438.  
  439. #if defined (VLNEXT)
  440.   tiop->c_cc[VLNEXT] = _POSIX_VDISABLE;
  441. #endif
  442.  
  443. #if defined (VDSUSP)
  444.   tiop->c_cc[VDSUSP] = _POSIX_VDISABLE;
  445. #endif
  446.  
  447. #endif /* TERMIOS_TTY_DRIVER && _POSIX_VDISABLE */
  448. }
  449. #endif /* !defined (NEW_TTY_DRIVER) && !defined(MINIMAL) */
  450.  
  451. /* Put the terminal in CBREAK mode so that we can detect key presses. */
  452. void
  453. rl_prep_terminal (meta_flag)
  454.      int meta_flag;
  455. {
  456. #if !defined (MINIMAL)
  457.   int tty = fileno (rl_instream);
  458.   TIOTYPE tio;
  459.  
  460.   if (terminal_prepped)
  461.     return;
  462.  
  463.   /* Try to keep this function from being INTerrupted. */
  464.   block_sigint ();
  465.  
  466.   if (get_tty_settings (tty, &tio) < 0)
  467.     {
  468.       release_sigint ();
  469.       return;
  470.     }
  471.  
  472.   otio = tio;
  473.  
  474.   prepare_terminal_settings (meta_flag, otio, &tio);
  475.  
  476.   if (set_tty_settings (tty, &tio) < 0)
  477.     {
  478.       release_sigint ();
  479.       return;
  480.     }
  481.  
  482.   control_meta_key (1);
  483.   terminal_prepped = 1;
  484.  
  485.   release_sigint ();
  486. #endif /* !MINIMAK */
  487. }
  488.  
  489. /* Restore the terminal's normal settings and modes. */
  490. void
  491. rl_deprep_terminal ()
  492. {
  493. #if !defined (MINIMAL)
  494.   int tty = fileno (rl_instream);
  495.  
  496.   if (!terminal_prepped)
  497.     return;
  498.  
  499.   /* Try to keep this function from being INTerrupted. */
  500.   block_sigint ();
  501.  
  502.   if (set_tty_settings (tty, &otio) < 0)
  503.     {
  504.       release_sigint ();
  505.       return;
  506.     }
  507. #ifdef NEW_TTY_DRIVER
  508.   readline_echoing_p = 1;
  509. #endif
  510.  
  511.   control_meta_key (0);
  512.   terminal_prepped = 0;
  513.  
  514.   release_sigint ();
  515. #endif /* !MINIMAL */
  516. }
  517.  
  518. /* **************************************************************** */
  519. /*                                    */
  520. /*            Bogus Flow Control                  */
  521. /*                                    */
  522. /* **************************************************************** */
  523.  
  524. rl_restart_output (count, key)
  525.      int count, key;
  526. {
  527.   int fildes = fileno (rl_outstream);
  528. #if defined (TIOCSTART)
  529. #if defined (apollo)
  530.   ioctl (&fildes, TIOCSTART, 0);
  531. #else
  532.   ioctl (fildes, TIOCSTART, 0);
  533. #endif /* apollo */
  534.  
  535. #else /* !TIOCSTART */
  536. #  if defined (TERMIOS_TTY_DRIVER)
  537. #    if defined (__ksr1__)
  538.   if (ksrflow)
  539.     {
  540.       ksrflow = 0;
  541.       tcflow (fildes, TCOON);
  542.     }
  543. #    else /* !ksr1 */
  544.   tcflow (fildes, TCOON);        /* Simulate a ^Q. */
  545. #    endif /* !ksr1 */
  546. #  else /* !TERMIOS_TTY_DRIVER */
  547. #    if defined (TCXONC)
  548.   ioctl (fildes, TCXONC, TCOON);
  549. #    endif /* TCXONC */
  550. #  endif /* !TERMIOS_TTY_DRIVER */
  551. #endif /* !TIOCSTART */
  552. }
  553.  
  554. rl_stop_output (count, key)
  555.      int count, key;
  556. {
  557.   int fildes = fileno (rl_instream);
  558.  
  559. #if defined (TIOCSTOP)
  560. # if defined (apollo)
  561.   ioctl (&fildes, TIOCSTOP, 0);
  562. # else
  563.   ioctl (fildes, TIOCSTOP, 0);
  564. # endif /* apollo */
  565. #else /* !TIOCSTOP */
  566. # if defined (TERMIOS_TTY_DRIVER)
  567. #  if defined (__ksr1__)
  568.   ksrflow = 1;
  569. #  endif /* ksr1 */
  570.   tcflow (fildes, TCOOFF);
  571. # else
  572. #   if defined (TCXONC)
  573.   ioctl (fildes, TCXONC, TCOON);
  574. #   endif /* TCXONC */
  575. # endif /* !TERMIOS_TTY_DRIVER */
  576. #endif /* !TIOCSTOP */
  577. }
  578.  
  579. /* **************************************************************** */
  580. /*                                    */
  581. /*            Default Key Bindings                */
  582. /*                                    */
  583. /* **************************************************************** */
  584. #if !defined (MINIMAL)
  585. void
  586. rltty_set_default_bindings (kmap)
  587.      Keymap kmap;
  588. {
  589.   TIOTYPE ttybuff;
  590.   int tty = fileno (rl_instream);
  591.  
  592. #if defined (NEW_TTY_DRIVER)
  593.  
  594.   if (get_tty_settings (tty, &ttybuff) == 0)
  595.     {
  596.       if (ttybuff.flags & SGTTY_SET)
  597.     {
  598.       int erase, kill;
  599.  
  600.       erase = ttybuff.sgttyb.sg_erase;
  601.       kill  = ttybuff.sgttyb.sg_kill;
  602.  
  603.       if (erase != -1 && kmap[erase].type == ISFUNC)
  604.         kmap[erase].function = rl_rubout;
  605.  
  606.       if (kill != -1 && kmap[kill].type == ISFUNC)
  607.         kmap[kill].function = rl_unix_line_discard;
  608.     }
  609.  
  610. #  if defined (TIOCGLTC)
  611.  
  612.       if (ttybuff.flags & LTCHARS_SET)
  613.     {
  614.       int werase, nextc;
  615.  
  616.       werase = ttybuff.ltchars.t_werasc;
  617.       nextc = ttybuff.ltchars.t_lnextc;
  618.  
  619.       if (werase != -1 && kmap[werase].type == ISFUNC)
  620.         kmap[werase].function = rl_unix_word_rubout;
  621.  
  622.       if (nextc != -1 && kmap[nextc].type == ISFUNC)
  623.         kmap[nextc].function = rl_quoted_insert;
  624.     }
  625.     }
  626. #  endif /* TIOCGLTC */
  627.  
  628. #else /* !NEW_TTY_DRIVER */
  629.  
  630.   if (get_tty_settings (tty, &ttybuff) == 0)
  631.     {
  632.       unsigned char erase, kill;
  633.  
  634.       erase = ttybuff.c_cc[VERASE];
  635.       kill = ttybuff.c_cc[VKILL];
  636.  
  637.       if (erase != (unsigned char)_POSIX_VDISABLE &&
  638.       kmap[erase].type == ISFUNC)
  639.     kmap[erase].function = rl_rubout;
  640.  
  641.       if (kill != (unsigned char)_POSIX_VDISABLE &&
  642.       kmap[kill].type == ISFUNC)
  643.     kmap[kill].function = rl_unix_line_discard;
  644.  
  645. #  if defined (VLNEXT) && defined (TERMIOS_TTY_DRIVER)
  646.       {
  647.     unsigned char nextc;
  648.  
  649.     nextc = ttybuff.c_cc[VLNEXT];
  650.  
  651.     if (nextc != (unsigned char)_POSIX_VDISABLE &&
  652.         kmap[nextc].type == ISFUNC)
  653.       kmap[nextc].function = rl_quoted_insert;
  654.       }
  655. #  endif /* VLNEXT && TERMIOS_TTY_DRIVER */
  656.  
  657. #  if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER)
  658.       {
  659.     unsigned char werase;
  660.  
  661.     werase = ttybuff.c_cc[VWERASE];
  662.  
  663.     if (werase != (unsigned char)_POSIX_VDISABLE &&
  664.         kmap[werase].type == ISFUNC)
  665.       kmap[werase].function = rl_unix_word_rubout;
  666.       }
  667. #  endif /* VWERASE && TERMIOS_TTY_DRIVER */
  668.     }
  669. #endif /* !NEW_TTY_DRIVER */
  670. }
  671. #endif /* !MINIMAL */
  672.