🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Ray Nickson Wed, 12 Jul 1989 22:36
key binding/stty character conflict
#309
Author: Ray Nickson
Date: Wed, 12 Jul 1989 22:36
84 lines
3230 bytes
ENVIRONMENT: bash 1.01 or 1.02 on an HP300 running MORE/BSD4.3
(although I believe it applies to any BSD system).

SYMPTOM: in the command-line editor, some commands don't work.

BUG: there is a conflict between the shell's interpretation of certain
keystrokes and the terminal driver's.  In my case, ^C, ^\, ^Z and ^Y are
bound (by stty) to INTR, QUIT, SUSP and DSUSP, so these keys (^Y in
particular) are not available for the shell.

FIX: we should save and zero the special characters before preparing
the terminal for command-line editing, and restore them when running
subprograms or editing.  The following cdiff for version 1.02 has been
tested in the above environment and appears to work; a similar patch
to readline.c in 1.01 should also work.

BTW: perhaps we should think about doing a full `tty sanity check and
restore' like tcsh does???

-rgn
--
nickson@comp.vuw.ac.nz       ...!uunet!vuwcomp!nickson      + 64 4 721000x8142


--------------------cut here--------------------
*** lib/readline.c.orig	Wed Jul 12 15:17:01 1989
--- lib/readline.c	Thu Jul 13 10:22:14 1989
***************
*** 1483,1494 ****
  
  int original_tty_flags = 0;
  struct sgttyb the_ttybuff;
  
  /* Put the terminal in CBREAK mode so that we can detect key presses. */
  rl_prep_terminal ()
  {
    int tty = fileno (rl_instream);
! 
    /* We always get the latest tty values.  Maybe stty changed them. */
  
    ioctl (tty, TIOCGETP, &the_ttybuff);
--- 1483,1498 ----
  
  int original_tty_flags = 0;
  struct sgttyb the_ttybuff;
+ struct tchars the_tchars;
+ struct ltchars the_ltchars;
  
  /* Put the terminal in CBREAK mode so that we can detect key presses. */
  rl_prep_terminal ()
  {
    int tty = fileno (rl_instream);
!   static struct tchars new_tchars = { -1, -1, -1, -1, -1, -1};
!   static struct ltchars new_ltchars = { -1, -1, -1, -1, -1, -1 };
!   
    /* We always get the latest tty values.  Maybe stty changed them. */
  
    ioctl (tty, TIOCGETP, &the_ttybuff);
***************
*** 1503,1508 ****
--- 1507,1517 ----
      }
    the_ttybuff.sg_flags |= CBREAK;
    ioctl (tty, TIOCSETN, &the_ttybuff);
+   /* save the special characters so we can use them for shell bindings */
+   ioctl (tty, TIOCGETC, &the_tchars);
+   ioctl (tty, TIOCGLTC, &the_ltchars);
+   ioctl (tty, TIOCSETC, &new_tchars);
+   ioctl (tty, TIOCSLTC, &new_ltchars);
  }
  
  /* Restore the terminal to its original state. */
***************
*** 1513,1518 ****
--- 1522,1530 ----
    the_ttybuff.sg_flags = original_tty_flags;
    ioctl (tty, TIOCSETN, &the_ttybuff);
    readline_echoing_p = 1;
+   /* restore special characters to saved values */
+   ioctl (tty, TIOCSETC, &the_tchars);
+   ioctl (tty, TIOCSLTC, &the_ltchars);
  }
  #endif  /* SYSV || HPUX */
  
key binding/stty character conflict
#311
Author: Brian Fox
Date: Thu, 13 Jul 1989 04:27
20 lines
1227 bytes
   Date: Thu, 13 Jul 89 10:36:45 +1200
   From: Ray Nickson <nickson@comp.vuw.ac.nz>

   ENVIRONMENT: bash 1.01 or 1.02 on an HP300 running MORE/BSD4.3
   (although I believe it applies to any BSD system).

   SYMPTOM: in the command-line editor, some commands don't work.

   BUG: there is a conflict between the shell's interpretation of certain
   keystrokes and the terminal driver's.  In my case, ^C, ^\, ^Z and ^Y are
   bound (by stty) to INTR, QUIT, SUSP and DSUSP, so these keys (^Y in
   particular) are not available for the shell.

ERROR:
	This is NOT a bug.  This is a design decision.  You are welcome
	to explain why it is necessary to change the users mind about
	what keys are special to the kernal.

Brian Fox
Re: key binding/stty character conflict
#312
Author: Bennett Todd
Date: Thu, 13 Jul 1989 16:44
19 lines
1464 bytes
I used to use ecsh on our systems; I am gradually converting users over
to bash. The biggest problem with ecsh is that it constantly did major
tty setting and resetting, and this tickled a bug in the SunOS 4.x tty
driver, which locked the console fatally requiring rebooting when
someone typed ^S. The situation, as far as I could tell, was that due to
output buffering ecsh would get the tty back while the previous
command's output was draining. The ^S would have been processed, leaving
the tty's output frozen, and ecsh would change the tty settings leaving
no character capable of restoring output. I was unable to find anything
that could be done either on the console or from another machine via
rlogin to unlock the console. I tried unsuccessfully to modify ecsh to
prevent it from having this problem. Bash doesn't currently have this
problem. 

Bash might not necessarly acquire this problem if you modify it as Ray
requested; it is a possibility to beware however.

-Bennett
bet@orion.mc.duke.edu
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads