Operating System - HP-UX
1830041 Members
1694 Online
109998 Solutions
New Discussion

TERM How to detect Terminalinformation

 
Bjarne Dein_1
New Member

TERM How to detect Terminalinformation

Hi Folks

Is there a better/more safe way of detecting terminal type then by ttytype?

My problem is, that TERM is set to vt100 by loginscript, byt ttytype tells me it's an vt200, which it's not!
It is an xterm or dtterm, how can that be correct detected?

I DO KNOW, that this can be set by TERM, but I want a autodetect
Knowlegde is not to know something, but how to...
7 REPLIES 7
H.Merijn Brand (procura
Honored Contributor

Re: TERM How to detect Terminalinformation

The program ttytype is about the most reliable way to check the ttytype. It is *very* hard to rewrite it from scratch (but doable :) and it's decision will look something like:

/* (void)fprintf (stderr, "PRIMARY DA Response: '%s'\n", buf);
* 61: vt100 family
* 62: vt200 family
* 63: vt300 family
* 64: vt400 family (NOT checked!)
* 1: 132-columns
* 2: printer port
* 3: ReGIS graphics
* 4: sixel graphics
* 5: ?
* 6: selective erase
* 7: soft character set
* 8: user-defined keys
* 9: NRC sets
* 13: local editing mode
* 15: DEC technical set
* 16: locator device port
* 18: user windows
* 19: dual sessions
*/
if (strcmp (buf + i, "1;2" ) == 0) return ("vt100");
if (strcmp (buf + i, "1;0" ) == 0) return ("vt101");
if (strcmp (buf + i, "6" ) == 0) return ("vt102");
if (strcmp (buf + i, "12;7;1;10;102" ) == 0) return ("vt125");
if (strcmp (buf + i, "7" ) == 0) return ("vt131");
if (strcmp (buf + i, "62;1;2;6;7;8;9" ) == 0) return ("vt220");
if (strcmp (buf + i, "62;1;2;3;4;6;7;8;9" ) == 0) return ("vt240");
if (strcmp (buf + i, "63;1;2;6;7;8;9" ) == 0) return ("vt320");
if (strcmp (buf + i, "63;1;2;3;4;6;7;8;9" ) == 0) return ("vt340");
if (strcmp (buf + i, "64;1;2;6;7;8;9" ) == 0) return ("vt420");
if (strcmp (buf + i, "64;1;2;3;4;6;7;8;9" ) == 0) return ("vt440");


It scans the DA respons from the terminal (emulator), which - in your case - obviously tell that it is vt200 compatible. So you have to find /why/ the DA respons of your terminal (emulator) is vt200 and fix it.

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Bjarne Dein
Advisor

Re: TERM How to detect Terminalinformation

Hi H.Merijn

Can tell anything about, where this problem might be?

PS. We use XVision as out frontend

Cheers
Bjarne
Knowlegde is not to know something, but how to get to...
melvyn burnard
Honored Contributor

Re: TERM How to detect Terminalinformation

Well I use the statement:
eval `ttytype -s`
tset
in my .profile as a matter of course, and this usually works fine for me, in hpterm and dtterm
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Artyom Voronchihin
Respected Contributor

Re: TERM How to detect Terminalinformation

Hello !

man tset. "tset -" reports terminal type.
"Intel inside" is not a label, it's a warning.
H.Merijn Brand (procura
Honored Contributor

Re: TERM How to detect Terminalinformation

I don't know XVision, but there just might be some setting somewhere that says: "Identify as vt200"

Since vt200 has almost no extra features over vt100 (another keyboard layout if I'm not mistaken), it's easy to deal with in your .profile

export TERM=`ttytype`
if [ "$TERM" = "vt200" ]; then
TERM=vt100
fi
Enjoy, Have FUN! H.Merijn
Bjarne Dein
Advisor

Re: TERM How to detect Terminalinformation

Hello Artyom,

That was it - thanks!

You should have points, but it doesn't seam to work at the moment - sorry!

Cheers
Bjarne
Knowlegde is not to know something, but how to get to...
H.Merijn Brand (procura
Honored Contributor

Re: TERM How to detect Terminalinformation

Bjarne, you can only asign points to yourself. You've posted as ID "CA710491", but answered as "BR662404", which also causes your own answers to not show "Authors question". Hey man, you can now give yourself points! :)
Enjoy, Have FUN! H.Merijn