🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.protocols.tcp-ip
Article #7960

Re: Help with termcap/terminfo needed

#7960
From: James Swanson
Date: Fri, 22 Jan 1993 18:32
62 lines
3032 bytes
|> I have an application running on 2 different flavours of Unix.  The applicati
on
|> uses function keys F1 to F4.  The are defined as generating ESC-@ ESC-A ESC-B
|> ESC-C.  On one system they are passed in to the application as the appropriat
e
|> function keys and on the other arrive separately as ESC and then @/B/C etc.
|> All the terminal definitions are exactly the same.
|> This looks like a timing problem.  Is there a code that can be modified to
|> fix this or is my problem somewhere else ? (Like in the application which is
|> Informix and about which I know sweet **??!!)
|>
|> AdvThx
|>
|> --
|> Jo Baker, D9                        |email: jo@siesoft.co.uk
|> Siemens Nixdorf, Oldbury,           |Tel:   +44 344 850450
|> Bracknell, Berks, RG12 4FZ          |Fax:   +44 344 850096

I had this exact problem using Informix on AIX 2.0.  This symptom would
occur only when I was accessing AIX through a psuedo terminal (telnet or
rlogin).  I tried to get help from Informix and AIX, but each said the other
was crewing up (suprise!).
The problem is caused by timing, as you suspected, in the AIX pseudo-
terminal driver.  If the ESC and the @/A/etc. are received in separate
packets, they will be delivered separately to the application.  The application
is supposed to wait long enough after an ESC for the following character
to determine if it is an escape sequence (there must be a better way).  In
the case of AIX, and possibly other systems, the time between delivery of
the 2 packets is too long.

Finally, I solved this by writting a "wrapper" around the Informix application.
The wrapper would read from stdin and "bunch-up" any escape sequences before
delivering them to the application in one "write()".

The wrapper:
        opened the "tty" in a mode that allowed all cahracters to pass
        Forked a child which exec()'d the Informix application
        The wrapper tied its stdout to the child's stdin
        The wrapper passed every character to the application
        if the wrapper saw an ESC, it checked for a follow-on character
          with a reasonable timeout
        If none came, the ESC was passed
        If one did come, the ESC and the follow-on were passed together
          in the same buffer.

The wrapper can be tweeked to get the best timeout value, optimize character
throughput by reading with NOWAIT, etc.

I wish I still had the code to share with you, but this was two jobs ago
and I have lost track of it.

Hope this helps.




-- 
Jim Swanson
First Boston Corporation
5WTC - 9th floor
New York, NY 10048
(212)322-1085
Technical Details
Message-ID: <C19q5J.Btt@csfb1.fir.fbc.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!csfb1!jswanson

Show Full Headers
Complete Article Headers
Newsgroups: comp.protocols.tcp-ip
Path: arc1-ca.pugleaf.net!sparky!uunet!csfb1!jswanson
From: jswanson@csfb1.fir.fbc.com (James Swanson)
Subject: Re: Help with termcap/terminfo needed 
Message-ID: <C19q5J.Btt@csfb1.fir.fbc.com>
Sender: news@csfb1.fir.fbc.com (Usenet News Account)
Reply-To: uunet!csfb1!jswanson
Organization: First Boston Corporation
Date: Fri, 22 Jan 1993 18:32:07 GMT
Lines: 62