Operating System - HP-UX
1845874 Members
3624 Online
110250 Solutions
New Discussion

ttytype cannot recognize "xterm" and "dtterm" terminals

 
SOLVED
Go to solution
Jdamian
Respected Contributor

ttytype cannot recognize "xterm" and "dtterm" terminals

If I run ttytype on a "xterm" or on a "dtterm" terminals, "vt100" and "vt200" are reported.

Why ?
7 REPLIES 7
Alex Glennie
Honored Contributor

Re: ttytype cannot recognize "xterm" and "dtterm" terminals

I think this is a known issue : CR# JAGad23863

The problems are reported when a dtterm of geometry != 80x24 is used to
rlogin/telnet to a remote system. The resulting connection will not
function correctly with curses applications until "eval resize" is
called.

The best workaround found is to link the vt200 terminfo DB entry on the
remote system to that of dtterm.

Does this sound like your scenario / problem ?
Jdamian
Respected Contributor

Re: ttytype cannot recognize "xterm" and "dtterm" terminals

It's not my scenario.

The dtterm terminal is 80x24.
Alex Glennie
Honored Contributor

Re: ttytype cannot recognize "xterm" and "dtterm" terminals

but it is your problem ;)
Alex Glennie
Honored Contributor
Solution

Re: ttytype cannot recognize "xterm" and "dtterm" terminals

FYI :

How is TERM set?

1) ttytype
/etc/profile contains these lines:
# set term if it's not set
if [ "$TERM" = "" -o "$TERM" = "unknown" -o "$TERM" = "dialup"
-o "$TERM" = "network" ]
then
eval `ttytype -s -a`
fi
export TERM

So if TERM is not set or set to "unknown", "dialup" or "network" ttytype tries
to identify your terminal.
This TERM setting is finally exported.
Usually you won't need ttytype to identify your current terminal.


How does ttytype try to identify a terminal

ttytype sends an identification request sequence to the terminal.
Finally the terminal's answer is interpreted using an ttytype internal mapping.
Undocumented feature: ttytype -D exactly shows the communication between the
ttytype command and the terminal.
Due to these facts a xterm is identified as vt100, which shouldn't be a problem
as xterm is vt100 compatible.Same is true of dtterm.

2) Start a local terminal (hpterm, dtterm or xterm) with a shell in it. The
xapplication (hpterm, dtterm, xterm) knows how to set TERM and passes this info
to the shell.

3) When you start a telnet or rlogin to another system the TERM still keeps set.
So the ttytype command of /etc/profile is NOT executed. According to the manpage
of telnetd the TERM is passed between to telnetd, which inherits it to the
shell.

4) su or newgrp (without the - option): TERM remains unchanged.

5) 'su -' or 'newgrp -': See the approriate man-page: In general TERM will get
lost, thus ttytype will be executed as part of /etc/profile. With HP-UX 11.0
TERM will remain unchanged!

Do you have a specific problem ?
Jdamian
Respected Contributor

Re: ttytype cannot recognize "xterm" and "dtterm" terminals

Actually my problem was to execute "ttytype" in order to get the geometry of the terminal and the ERASE char (perhaps other commands report this, but I only know "ttytype").

I modified the line where TERM is checked in the /etc/profile script in order to check LINES COLUMNS and ERASE vars.

Then TERM was wrongly updated.

Now I restored the original line and I added a IF clause to check those vars:

if [ "$LINES" = "" -o "$COLUMNS" = "" -o "$ERASE" = "" ]
then
eval `ttytype -s -a | grep -v "^TERM="`
fi

These lines get properly the terminal geometry and ERASE char.

But unfortunately all user $HOME/.profile scripts executes an stty command to force the ERASE char of the session to ^H.

I had to modify these user profiles in order to prevent this because the /etc/profile sets properyly this value
Jdamian
Respected Contributor

Re: ttytype cannot recognize "xterm" and "dtterm" terminals

I would like these improvements would been taken into account by HP in order to solve all problems caused by different terminals (and emulation terminals) that use diffente ERASE chars
Bill Hassell
Honored Contributor

Re: ttytype cannot recognize "xterm" and "dtterm" terminals

Actually, there is no communication protocl that can properly identify dtterm. It was written (like most emulators) to 'look' like a real terminal, but it is still an emulator. ttytype is a guessing program that tries to ID a terminal using escape sequences and looking for a response.

dtterm usually looks like a vt200 series and can return vt200 or vt220. However, there are several differences between the vt200 capability and dtterm. To see this, use the commands:

untic vt200
untic dtterm

So the problem is not with ttytype but with dtterm which is unable to provide any feedback on just what value for $TERM to use. I would put in code to test for vt200 and vt220 and if true, set TERM=dtterm.

Or you can use a smart terminal emulator (hpterm) which can be accurately identified. hpterm has the advantage of fitting common character mode tools like sam and swinstall and Glance, without clumsy workarounds.


Bill Hassell, sysadmin