Subject: Re: global setting of tty modes
To: None <netbsd-help@NetBSD.ORG>
From: Tom Pavel <pavel@MAILBOX.SLAC.Stanford.EDU>
List: netbsd-help
Date: 07/31/1995 22:17:28
Kind of silly, following up to my own question of more than a month
ago, but I think I finally figured things out, and perhaps some of
this might be helpful for someone else...


>>>>> On Wed, 21 Jun 1995, Tom Pavel <pavel@sunreine.SLAC.Stanford.EDU> writes:

> Is there a good way to arrange that all of my xterm windows come up
> such that I don't need to remember to type "stty -ixon"?  I can't see
> any reason that I would want XON/XOFF flow control, so I'd like to
> disable it globally.  Is there a parameter in the kernel that controls
> this?  Or perhaps something in /etc/ttys (or does that only get
> consulted for ptys if you do a real login)?  Is there a simple way to
> do what I want?


Somewhere along the line, I discovered there is a file
<sys/ttydefaults.h> that constains macros like:
	...
	#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
	...
These macros are used in the kernel to set the initial settings on
terminals.  I was able to remove IXON from this set, and presto, all
my ttyv?  terms came up with -ixon.  However, this didn't affect the
xterms (which is what I mostly use).

It seems that in the source to xterm (main.c), IXON is explicitly set
in d_tio.c_iflag.  There appears to be no way to control this with
resources.  So the answer appeared to be to hack the xterm source.

However, it turned out that all of this is really a red herring.  My
real problem was not so much that "stty ixon" was set, but that cu or
rlogin were not unsetting it when I connected to a remote node (in
retrospect, it's fairly obvious that both programs need to set the
terminal into "raw" mode, so that signals and such get passed to the
remote "terminal").  It seemed that rebuilding my user-land cured
this.  I have not tracked down what, if anything, changed, but I think
we picked up a newer version of the Taylor UUCP sources (cu).  I don't
quite remember whether I had problems (e.g. emacs not getting ^S on
the remote machine) with both rlogin/SLIP and cu, or only with cu.
Either way, I have no problems now.


So, I'm pretty much convinced that I understand this now.  But I'm
still not sure why +ixon is the default and not -ixon.  Is this
required by some part of POSIX?  Does anyone still use
terminals/modems without hardware flow control?  I suppose that if all
relevant programs set the term to raw mode when they need to, then
+ixon does no harm and may make life easier for someone.  Seems
anachronistic to me, though...



Tom Pavel

Stanford Linear Accelerator Center
pavel@slac.stanford.edu                 http://www.slac.stanford.edu/~pavel/