[comp.unix.wizards] How do I get "filec" to work on a pty?

flan@ai.wustl.edu (Ian "Wildebeest" Flanigan) (04/07/90)

Hello wizards!

I'm having trouble getting the C-shell "filec" flag to do its thing
correctly on a pseudo terminal.  I open the pty and set the mode to be
~(RAW | LCASE | CBREAK) and (FF0 | ECHO | CRMOD).  Now the terminal opens
just fine and the csh attached to it works normally except for when I type
a line like:

ls /usr/bin/a^D

Then it gives me the directory listing, but neglects to re-print or even
remember the line that I've typed so far.  Now when I use escape like:

ls /usr/ucb/whoa^[

the name is completed, but the whole line is forgotten, <POOF!>.

Does anyone know what I can to to fix the problem?

Thanks.


Ian Flanigan

flan@ai.wustl.edu              "You can never have too many napkins."
wucs1.wustl.edu!ai!flan@uucp

guy@auspex.auspex.com (Guy Harris) (04/08/90)

>I'm having trouble getting the C-shell "filec" flag to do its thing
>correctly on a pseudo terminal.

It's difficult to get much of *anything* to "do its thing correctly" on
a pseudo-terminal, if all you have is a pseudo-terminal and nothing on
the master side.  If you have some program on the master side, that
program is as much a part of the tty subsystem as the pseudo-tty itself,
so in order for somebody to advise you, you have to indicate what you're
running on the master side.... 

For instance, it seems to work just fine in:

	SunView's "shelltool"
	X11's "xterm"
	XView's "shelltool" under X11
	"script"
	"rlogin"
	"telnet", at least when no fancy line-mode stuff is being done

and fails under SunView's "cmdtool" and probably Andrew's "tm" under
X11, for related but different reasons.

>I open the pty and set the mode to be ~(RAW | LCASE | CBREAK) and
>(FF0 | ECHO | CRMOD).

Can I infer from this that you're writing your own program to handle the
pseudo-tty?

If so, does your program run the pseudo-tty in "remote" mode
(TIOCREMOTE) or not?

If it does not - i.e., your program is more-or-less acting like a dumb
terminal, supplying raw keystrokes to the pseudo-tty with no echoing or
special input processing and displaying output from the pseudo-tty -
then assuming you've set up the pseudo-tty correctly (your setup seems
OK) it should work. 

If it *does*, you have a problem, in that the C shell performs various
unnatural acts to implement filename completion, and your program may
not find out about those acts.  Some pseudo-tty implementations don't
let you find out about them at all; others don't let you do so well
enough to make this stuff work; others do so well enough to force you to
figure out how to handle them....