[comp.unix.aix] Pseudo-ttys and hft's

ahall@vision.UUCP (Andy Hall) (07/09/90)

Hi,

 	I have a 6150 running AIX 2.2.1.
	I have written a program which uses pseudo ttys  to interface to a net
much the same as telnet does. I sit on the master side of the pty and regular
applications, i.e. sh vi etc., sit on the other. 


                     sh

                   --------
                  |  pts   |
                  | ------ |  pseudo-tty
                  |  ptc   |
                   --------

                    my prog

                       |
                       |
                       |
                   the wire

My problem is: when I start up
vi or pg or the like, someone writes  " ESC [ x ......." on the data stream.
	I have discovered that this is a hft ( High Function Terminal ) ioctl
call which gets thrown on the data stream if the device is a pseudo tty. But how
did it get there, (did vi write it ?), and how do I stop it.  Do I have to 
inspect the whole data stream and strip out hft calls?

	Help.

Replies via email please:

ahall@vision.uucp

robin@sabre.austin.ibm.com (Robin D. Wilson/1000000) (07/10/90)

In article <1139@vision.UUCP> ahall@vision.UUCP (Andy Hall) writes:
> 	I have a 6150 running AIX 2.2.1.
>	I have written a program which uses pseudo ttys  to interface to a net
>much the same as telnet does. I sit on the master side of the pty and regular
>applications, i.e. sh vi etc., sit on the other. 
>
>My problem is: when I start up
>vi or pg or the like, someone writes  " ESC [ x ......." on the data stream.
>	I have discovered that this is a hft ( High Function Terminal ) ioctl
>call which gets thrown on the data stream if the device is a pseudo tty. 

This is due to the call "termdef()" and/or "setupterm()".  Both of these 
calls uses the hftctl() calls to determine window size on an hft.
(Of course, since you are not on a "real" hft you don't really expect them, 
but the pts usually do some sort of hft emulation.) The "rlogin" program is 
setup to emulate an hft where neccessary (the local host tty is an hft or 
pts), and the telnet program is currently set to just discard hft escape 
sequences.  (This will change some in a future update.)  The problem is, how
to emulate an hft.  If the environment variables TERM, LINES and COLUMNS are
all set, the hft escapes will not be sent (since termdef() and setupterm()
take the environment defaults if they are set).  (This was not the case 
at the initial release level of AIX2.2.1; at that level termdef() and 
setupterm() ignored the environment and tried to figure out the "real" 
terminal type.)  The next few update levels (mpp update 1769/70/71 or
2707/08 will have a new version of the termdef() and setupterm() functions.
Once these programs are modified, things may change slightly.  The best
way around your problem is to do some sort of limited hft emulation in 
your program.  Otherwise I suggest that the environment variables be set
upon login by either your program, or the users shell profile.


+-----------------------------------------------------------------------------+
|The views expressed herein, are the sole responsibility of the typist at hand|
+-----------------------------------------------------------------------------+
|UUCP:     cs.utexas.edu!romp!ibmchs!auschs!sabre.austin.ibm.com!robin        |
|USNail:   701 Canyon Bend Dr.                                                |
|          Pflugerville, TX  78660                                            |
|          Home: (512)251-6889      Work: (512)823-4526                       |
+-----------------------------------------------------------------------------+