[comp.unix.wizards] Multiply-defined sgtty characters?

cep4478@ultb.UUCP (C.E. Piggott ) (11/08/88)

Hello -

	Ultrix-32 (v. 2.4)'s Berkeley-like csh (/usr/new/csh, to be
more precise) has a pretty weird (I think) effect in the name of file-
name completion.

	What it does is to assign an additonal character to EOF.  (Escape),
so that stty everything yields:

							eof
							^D/^[

This is anything but desirable, since unlike the normal csh, ESCAPE is
treated specially outside the command line.  (example. trying to use the
escape key in another program yields EOF)

	I'm not going to bother asking whose idea this was.  What I would
like to know is whether or not stty will let me clear this extra character.
typing "stty eof ^D" sets the first EOF, but doesn't clear the second.
"stty eof ^d^@" doesn't seem to do it either.

	Ideas?  Thanx...

						/Chris

cep4478@ritcv.rit.edu

aida@porthos.csl.sri.com (Hitoshi Aida) (11/10/88)

In article <174@ultb.UUCP> cep4478@ultb.UUCP (C.E. Piggott (634EEC)) writes:
>
>	Ultrix-32 (v. 2.4)'s Berkeley-like csh (/usr/new/csh, to be
>more precise) has a pretty weird (I think) effect in the name of file-
>name completion.
>
>	What it does is to assign an additonal character to EOF.  (Escape),
>so that stty everything yields:
>
>							eof
>							^D/^[

It's not another EOF charactor but so-called break character.
The difference between EOF charactor and break character is
EOF character is not "read" when it is typed, but break character
is included in input.  Thus break charactor is much like new-line
character than EOF.  Showing break character in pair with EOF
character is only the taste of stty command.

To clear break character
	% stty brk undef
is probably the easiest way.
--------
Hitoshi AIDA
Computer Science Lab, SRI International

guy@auspex.UUCP (Guy Harris) (11/11/88)

>	What it does is to assign an additonal character to EOF.

No, you misunderstand the way the BSD "stty" command reports control
character settings; it doesn't assign it to the EOF character, it
assigns it to what in V7/BSD land is called the "break" character and in
S3/S5 land is called the "end-of-line" character.  This character acts
as an "alternative end-of-line" - it basically behaves like NEWLINE, in
that it causes the line currently being edited to be completed, and
becomes the last character on the line.

>This is anything but desirable, since unlike the normal csh, ESCAPE is
>treated specially outside the command line.

The 4.3BSD "csh" appears (at least in its SunOS 4.0 incarnation, and
probably elsewhere as well) to have the end-of-line character set to
ESCAPE *only* when it is reading from the terminal; it politely disables
the end-of-line character when it gives control of the tty to another
program.

If the Ultrix "/usr/new/csh" doesn't do this, it's either a bug or a
misfeature, and should be fixed.  I don't know if "/usr/new/csh" is the
4.3BSD C shell, the "tcsh" C shell, or something else.

>	I'm not going to bother asking whose idea this was.

Given that the 4.3BSD C shell does not run in "cbreak" mode, wherein it
would see every character as it is typed, it is obliged to set the
end-of-line character to ESCAPE, so that it can at least see the ESCAPE
as soon as it is typed, instead of requiring you to type ^D after it. 
As such, it is a good idea, as long as it puts things back the way they
were when it runs another program.

>What I would like to know is whether or not stty will let me clear this
>extra character.

Yes.  You have to ask it to change the "break" character; asking it to
change the EOF character won't help.  Assuming the Ultrix "stty" is
basically the 4.3BSD one, you would do

	stty brk undef

Of course, if the C shell detects that the "break" character was turned
off, and turns it back on again, you'd lose; in this case, you'll either
have to not run "/usr/new/csh" or get the bug/misfeature fixed.