Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


LinkBack Search this Thread
Old 10-20-2013, 04:20 PM   #1
Registered: Dec 2010
Posts: 45

Rep: Reputation: 1
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:

$ 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:

$ 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=^I:is=\\E)0:\\\n\t:li#33:co#113:am:xn:xv:LP:sr=\\EM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: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.
Old 10-20-2013, 05:53 PM   #2
Senior Member
Registered: May 2008
Posts: 3,231

Rep: Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828
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.
Old 10-21-2013, 12:15 AM   #3
Petri Kaukasoina
Registered: Mar 2007
Posts: 241

Rep: Reputation: 86
Originally Posted by average_user View Post
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.)
1 members found this post helpful.
Old 10-21-2013, 04:29 PM   #4
Registered: Dec 2010
Posts: 45

Original Poster
Rep: Reputation: 1
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?
Old 10-21-2013, 07:07 PM   #5
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 271
Blog Entries: 4

Rep: Reputation: 256Reputation: 256Reputation: 256
/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:

# [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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Login shells / Non-login shells tofee Linux - Newbie 1 03-24-2006 11:03 PM
termcap-BSD merchtemeagle Slackware 1 03-08-2005 01:18 PM
termcap bsd or termcap linux? little_ball Slackware 5 12-01-2004 10:22 AM
Bash and login shells Adrohak Linux - Software 3 11-18-2004 10:21 AM
Login shells vs non-login shells lsmith Linux - General 2 03-31-2004 07:29 PM

All times are GMT -5. The time now is 10:50 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration