LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Is /etc/termcap-BSD used only for non-login shells? How is it done? (http://www.linuxquestions.org/questions/slackware-14/is-etc-termcap-bsd-used-only-for-non-login-shells-how-is-it-done-4175481519/)

average_user 10-20-2013 04:20 PM

Is /etc/termcap-BSD used only for non-login shells? How is it done?
 
I have a basic understanding of terminal emulators in *nix systems but I have come across a situation I can't explain. I am using GNU screen on my host system with Slackware 13.37 (yeah, time to upgrade, that's a different story). I ssh into Slackware 14.0 box in my LAN with bash 4.2.37. On remote system my $TERM variable is set to `screen'. My problem is that C-l doesn't clear screen but `clear' command itself does. I know that it's readline related issue. readline uses termcap database instead of terminfo. I see there are 3 termcap databases:

Code:

$ ls -Alhtr /etc/termcap*
-rw-r--r-- 1 root root 690K Mar  3  2000 /etc/termcap-BSD
-rw-r--r-- 1 root root 8.8K Feb 16  2004 /etc/termcap
-rw-r--r-- 1 root root 8.8K Feb 16  2004 /etc/termcap-Linux

I noticed that for a proper for screen terminal type can only be found in termcap-BSD. I did symlink /etc/termcap to /etc/termcap-BSD, logged out and logged in and C-l could clear screen. I had a similar situation with lack of entry for screen terminal type in termcap database on one of systems at work so this came as no surprise for me. What surprised is that when Xorg was started and I started xterm I could use C-l with no problems. That makes me think that termcap-BSD is used by default for non-login shells. In xterm inside Xorg session $TERMCAP variable returns value of screen key in termcap database:

Code:

$ echo $TERMCAP
TERMCAP=$'SC|screen|VT 100/ANSI X3.64 virtual terminal:\\\n\t:DO=\\E[%dB:LE=\\E[%dD:RI=\\E[%dC:UP=\\E[%dA:bs:bt=\\E[Z:\\\n\t:cd=\\E[J:ce=\\E[K:cl=\\E[H\\E[J:cm=\\E[%i%d;%dH:ct=\\E[3g:\\\n\t:do=^J:nd=\\E[C:pt:rc=\\E8:rs=\\Ec:sc=\\E7:st=\\EH:up=\\EM:\\\n\t:le=^H:bl=^G:cr=^M:it#8:ho=\\E[H:nw=\\EE:ta=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kI=\\E[2~:kD=\\E[3~:ku=\\EOA:kd=\\EOB:\\\n\t:kr=\\EOC:kl=\\EOD:km:'

I wonder how is it done. Where is information about termcap database that should be in use stored? I did not found any trace of setting a default termcap database in bash startup files in $HOME or /etc or in Xorg startup files.

GazL 10-20-2013 05:53 PM

Programs that use libtermcap always read /etc/termcap. if you want to use the bigger termcap-BSD you have to copy it over /etc/termcap.

I discovered the same problem with TERM=screen the other day, but rather than copy the entire termcap-BSD over, I just copied the single entry for 'screen' to the /etc/termcap.

Petri Kaukasoina 10-21-2013 12:15 AM

Quote:

Originally Posted by average_user (Post 5049264)
I had a similar situation with lack of entry for screen terminal type in termcap database on one of systems at work so this came as no surprise for me. What surprised is that when Xorg was started and I started xterm I could use C-l with no problems.

I wonder how is it done. Where is information about termcap database that should be in use stored?

Programs using termcap read /etc/termcap unless the $TERMCAP environment variable is set, just as you found out! screen sets it for the benefit of programs using termcap. When $TERMCAP is set, programs read from $TERMCAP instead of /etc/termcap. (But ssh does not copy the environment to the other computer so it won't work for the remote connection.)

average_user 10-21-2013 04:29 PM

Ok, I see. Do you know what's the reason there are 3 different termcap databases included in Slackware? What is the idea behind it?

55020 10-21-2013 07:07 PM

/etc/termcap is (by default) a copy of /etc/termcap-Linux, but if you prefer you can overwrite it with a copy of /etc/termcap-BSD instead. termcap (and termcap-Linux) starts with this comment:

Quote:

# [Slackware note: If you're looking for a big, full-featured termcap,
# use /etc/termcap-BSD instead ]
So what are termcap-BSD and termcap-Linux? Well, termcap-BSD is a huge database that describes pretty much every terminal device since the Devensian glaciation. ADM3, TVI910, VT52, Decwriters and teletypes, BEOS and SCO consoles. Even if the last unit went to landfill thirty years ago, termcap-BSD still knows how to drive it.

But you almost certainly don't want a huge list of dead terminals slowing down your Linux console or xterm or screen session. So there is also a much smaller database containing only the good stuff, and that is termcap-Linux.


All times are GMT -5. The time now is 12:18 AM.