🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #853

Bash 1.04 patch: termio support

#853
From: Chip Salzenberg
Date: Mon, 22 Jan 1990 18:48
94 lines
2593 bytes
As distributed, Bash 1.04 picks up the current erase and kill characters from
the tty mode structure -- but only for BSD, not SysV.  This patch adds this
feature for SysV, and also cleans up the ttymode code a little.

Index: readline/readline.c
***************
*** 1035,1060 ****
  readline_default_bindings ()
  {
! #ifdef TIOCGETP
!   struct sgttyb ttybuff;
    int tty = fileno (rl_instream);
  
!   if (ioctl (tty, TIOCGETP, &ttybuff) != -1)
!     {
!       int erase = ttybuff.sg_erase, kill = ttybuff.sg_kill;
  
!       if (erase != -1 && keymap[erase].type == ISFUNC)
! 	keymap[erase].function = rl_rubout;
  
!       if (kill != -1 && keymap[kill].type == ISFUNC)
! 	keymap[kill].function = rl_unix_line_discard;
      }
  
  #ifdef TIOCGLTC
    {
      struct ltchars lt;
  
!     if (ioctl (tty, TIOCGLTC, &lt) != -1)
        {
! 	int erase = lt.t_werasc, nextc = lt.t_lnextc;
  
  	if (erase != -1 && keymap[erase].type == ISFUNC)
--- 1037,1063 ----
  readline_default_bindings ()
  {
!   int erase = -1, kill = -1;
    int tty = fileno (rl_instream);
  
! #ifdef NEW_TTY_DRIVER
  
!   struct sgttyb ttybuff;
  
!   if (ioctl (tty, TIOCGETP, &ttybuff) == 0)
!     {
!       erase = ttybuff.sg_erase;
!       kill = ttybuff.sg_kill;
      }
  
  #ifdef TIOCGLTC
+ 
    {
      struct ltchars lt;
+     int erase, nextc;
  
!     if (ioctl (tty, TIOCGLTC, &lt) == 0)
        {
! 	int erase = lt.t_werasc;
! 	int nextc = lt.t_lnextc;
  
  	if (erase != -1 && keymap[erase].type == ISFUNC)
***************
*** 1065,1070 ****
        }
    }
  #endif /* TIOCGLTC */
! #endif /*  TIOCGETP */
  }
  
--- 1068,1091 ----
        }
    }
+ 
  #endif /* TIOCGLTC */
! 
! #else /* not new driver */
! 
!   struct termio ttyio;
! 
!   if (ioctl (tty, TCGETA, &ttyio) == 0)
!     {
!       erase = ttyio.c_cc[VERASE];
!       kill = ttyio.c_cc[VKILL];
!     }
! 
! #endif  /* not new driver */
! 
!   if (erase != -1 && keymap[erase].type == ISFUNC)
!     keymap[erase].function = rl_rubout;
! 
!   if (kill != -1 && keymap[kill].type == ISFUNC)
!     keymap[kill].function = rl_unix_line_discard;
  }
  
Technical Details
Message-ID: <m0gq95n-0007nfC@ateng.ateng.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ateng.ateng.com!chip

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ateng.ateng.com!chip
From: chip@ateng.ateng.com (Chip Salzenberg)
Newsgroups: gnu.bash.bug
Subject: Bash 1.04 patch: termio support
Message-ID: <m0gq95n-0007nfC@ateng.ateng.com>
Date: 22 Jan 90 18:48:42 GMT
Sender: pollack@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 94