OT: linux vs vt100 termcap problems + screen - help!
Brian K. White
brian at aljex.com
Wed Dec 8 13:42:01 PST 2010
On 12/8/2010 3:33 PM, Fairlight wrote:
>> From inside the gravity well of a singularity, Brian K. White shouted:
>> I have not looked deeply into it since I haven't cared yet, but trying
>> to help someone else here the other day I saw that screen sets TERM to
>> "screen.${TERM}", and in /etc/termcap there are screen.linux,
>> screen.rxvt etc...
>
> THANK YOU!
>
> Setting local to linux and remote to screen.linux works perfectly for both
> yast on Linux, and mutt on Solaris and Linux.
>
> My only real annoyance is that I might log into the Solaris server either
> directly from Anzio (or PuTTY), or I may log in from inside screen--both
> from the same IP#--and they won't enable sshd environment setting for users
> due to (valid) security concerns. So I have yet to figure out an
> -automated- way of making my login process decide if it should run linux or
> screen.linux, since I'm coming from the same IP# no matter what (in this
> case, anyway). If anyone has a genius solution to that, let me know. I've
> been over things six ways from Sunday and can't figure out a decent way to
> determine a decent way to automate setting TERM to the right one yet.
>
> Other than that, the raw solution works. Got it working with custom
> TERMINFO and TERMCAP variables and files last night, and got the admin to
> install screen.termcap into both termcap and terminfo today once I knew it
> would work.
>
> THANKS, Brian! HUGE help!
>
> Thanks to everyone that gave input...the effort is appreciated greatly!
That is what "answerback" is for.
I don't know if it's possible to configure screen to respond with an
aswerback of your choice, or if it already answers back with something
recognizable of it's own. If either is true, then you can put this in
/etc/profile /etc/profile.local or .profile
read -s -t 1 -p $'\005' MYTERM # bash-specific
$MYTERM will contain the terminal answerback string, minus a trailing
newline, and only up to the first newline for that matter, if any.
You can do this other ways but if you have bash with it's -t option,
that's the most convenient and reliable. Otherwise you can make a little
c program (look up an old program called qterm, or I bet Bob has
something on Anzio.com just like he has passthru, I have a program that
I think doesn't actually work so we'll skip that...) or you can just use
regular read (which will wait forever until you press Enter) and ensure
that your answerback string includes a trailing ^M if it's configurable
at all.
I usually include the trailing newline even though the host has bash,
because that just makes the process go as fast as possible instead of
forcing the read command to wait -t seconds for no reason, and of course
just as a bonus it means the same string works on hosts without bash.
It IS configurable in Anzio and Putty, including the ^M. Anzio's syntax
isn't litterally ^M but I know it has some sort of syntax to do that
because I used it. A pipe | ? But you specifically need to detect
screen, not your real terminal, so don't bother with that.
Conversely, if screen doesn't answerback at all, maybe there is some
trick you could cause screen to eat the ^E coming from the host and
neither respond to it nor pass it to the terminal, (define a bogus
termcap/terminfo field?) I guess you could detect screen by omission
that way. Um, blech.
I'm a little unclear why screen's natural TERM auto-setting doesn't
work. You're saying the host isn't letting the client even set TERM?
That's beyond security into simply broken. The terminal is supposed to
tell the host "I am a XX terminal." via TERM, and screen does so by
setting TERM to screen.$TERM. TERM has always been a special case, and
now LANG and/or a few LC_* variables are added in the same boat for the
same reasons, and no other variables passed. Generally this just works
unless you go out of your way to break it by overwriting $TERM. My
problems were basically just filepro since I simply haven't made a
screen.linux or screen.scoansi termpcap entries for filepro yet.
Midnight commander and yast seem to work fully as long as all boxes
involved have screen.* termcap and terminfo entries.
--
bkw
More information about the Filepro-list
mailing list