[comp.unix.questions] TERMCAP / TERMINFO difference?

ruck@beach.cis.ufl.edu (John Ruckstuhl) (09/30/90)

Please give me a history lesson --

Information in the TERMCAP database seems to be almost duplicated by
information in the TERMINFO database.  Why?  

Is it faster to access TERMINFO-info than TERMCAP-info?

Does typical software (eg, "vi") know to look first at one, then, if
unsuccessful, look at the other database?
How is TERMCAP-info kept synchronized with $TERMINFO-info?  Does it
depend only on the diligence of the system administrator?

A "strings" on /usr/ucb/vi seemed to indicate it used a search path 
TERMINFO, and maybe doesn't even look to TERMCAP.

I am using SunOS 4.1 on SPARCstations

Thank you for your comments,
ruck.
--
John R Ruckstuhl, Jr
University of Florida		ruck@cis.ufl.edu, uflorida!ruck

gwyn@smoke.BRL.MIL (Doug Gwyn) (10/01/90)

In article <24636@uflorida.cis.ufl.EDU> ruck@beach.cis.ufl.edu () writes:
>Please give me a history lesson --

Ok:  The termcap scheme was invented at UCB in support of the multi-terminal
text editor "vi".  "vi"'s display management routines were eventually
extracted into a separate "curses" library for use by other applications.

One of the UCB termcap/curses maintainers, Mark Horton, decided that the
termcap scheme had too many restrictions and other deficiencies, including:
	- scanning /etc/termcap to find the terminal description took too long
	- tgoto()-like capabilities were insufficiently programmable to cover
		some more recent terminal designs
	- 2-character capability names were becoming quite strained
Terminfo (and its associated "curses" library) was designed to address
these concerns.  It supports a superset of the termcap attributes, offers
a programmable stack machine for tgoto()-like capabilities, and accesses
the terminal description directly (actually, the kernel does have to do a
search for mathcing entries in two directories, but this is much faster
than the old termcap contents search).  The terminal description is
precompiled into a binary form for faster loading.

Mark took "terminfo" to AT&T with him, and it was adopted for UNIX System
V Release 2 as a replacement for "termcap" (which was temporarily still
supported in SVR2).  UCB, however, stuck with termcap for quite a while
(through 4.3BSD at least), merely bringing the termcap manual entry up to
date with the SVR2 version of terminfo insofar as possible (I was the
editor for the 4.3BSD termcap manual entry).  Pavel Curtis provided his
own public-domain implementation of terminfo/curses, but I don't think it
really caught on.

Virtually all applications that use one or another of these facilities
are built to use just one of them; it would be difficult to do otherwise,
since the implementations of the curses library functions differs somewhat
for the two schemes.  There is also no automatic mechanism for keeping
terminal descriptions in sync between the two databases.  There are some
tools that aid in converting descriptions from one form to the other,
however.  Generally, AT&T seems to think that nobody should be using
termcap at this point, and that terminfo is the only supported scheme.