Subject: Re: Cryptic behavior...
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: current-users
Date: 03/12/1998 18:27:50
> I wrote once long ago about a problem where mail(1) would stop
> echoing responses to me, stop processing ^D, and so on.

> Nothing else was affected.  ksh is happy, trn is happy, vi is happy.

There are lots of other programs out there.  See below....

> It looks like this is caused by the equivalent of
> 	stty -echo -echoe -icanon -pendin
> happening.

> If so, can you explain why it doesn't affect my shell, or any other
> program I can think of?  Maybe this is one of those ksh magic things.

Well, I note that ksh, trn, and vi are all programs that do the
equivalent of -echo -icanon themselves (ksh for command-line editing,
the other two because their user interface demands they do cbreak-style
input).  Perhaps mail(1) is the only program you regularly use that
doesn't do cbreak?

Until I put locktty into my shell I had similar problems: a cbreak or
raw program would crash on me and leave my tty settings pretty mangled,
and I wouldn't notice because the shell would run happily.  But then I
added locktty, and the problem went away.  (What does it do?  When you
do "set locktty", at the next opportunity the shell does a tcgetattr()
and saves the result.  Every time it gets the opportunity thereafter,
it does a tcsetattr() to the saved state (unless and until locktty gets
unset, of course).  This means that I had to alias stty to "unset
locktty; /bin/stty \^?:*; set locktty", but that's a small price to pay
for never having to worry about crashing programs screwing up my tty
state again.)

					der Mouse

		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B