[gnu.gdb.bug] gdb-3.4 readline destroys local tty modes +FIX

jfp@practic.com (John F. Peters) (11/26/89)

Description:
	gdb3.4 on Vax 4.3bsd-Tahoe:
	When terminal parity is set to anything other than EVENP+ODDP,
	local modes are all zero after running gdb.

Repeat-By:
	* Find a terminal that generates parity in the eighth bit.
	* stty even -odd crt decctlq  (or odd -even)
	* run gdb
	* stty everything
	(local modes e.g. decctlq, crtbs, crterase, etc. are all gone)
Fix:
	In readline/readline.c, rl_prep_terminal and rl_deprep_terminal
	aren't symmetric.  Incoming local modes are saved only when parity
	is set to EVENP+ODDP, but later they're restored unconditionally.
	Thus when parity is set to anything but EVENP+ODDP, local modes
	get restored from a word that's all zero.

	This fix applies the same EVENP+ODDP test at restoration time.

-----
jfp@practic.com


*** readline.c.orig	Thu Oct 19 14:26:49 1989
--- readline.c	Sat Nov 25 10:14:40 1989
***************
*** 2078,2084 ****
    int tty = fileno (rl_instream);
  
  #if defined (TIOCLGET) && defined (LPASS8)
!   ioctl (tty, TIOCLSET, &local_mode_flags);
  #endif
  
  #ifdef TIOCSLTC
--- 2078,2085 ----
    int tty = fileno (rl_instream);
  
  #if defined (TIOCLGET) && defined (LPASS8)
!   if ((the_ttybuff.sg_flags & (ODDP | EVENP)) == (ODDP | EVENP))
!      ioctl (tty, TIOCLSET, &local_mode_flags);
  #endif
  
  #ifdef TIOCSLTC