[comp.terminals] 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.

guy@auspex.auspex.com (Guy Harris) (10/02/90)

>Virtually all applications that use one or another of these facilities
>are built to use just one of them;

In particular, the SunOS 4.1 "vi" uses only "terminfo" (it's based on
the S5R3.1 "vi", mainly to pick up the support for 8-bit characters).

As for some of the original poster's other questions, in case he didn't
infer the answers from Doug's explanation:

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

Because some systems support both "termcap" and "terminfo", for various
reasons, and therefore have to supply both the "termcap" and "terminfo"
databases.

> How is TERMCAP-info kept synchronized with $TERMINFO-info?  Does it
> depend only on the diligence of the system administrator?

The system administrator and the vendor(s) involved.  Most of the
"termcap" entries in SunOS come from the BSD "termcap" file, and most of
the "terminfo" entries in SunOS come from the S5 distribution (4.3BSD
and System V Release 3.1, respectively, in SunOS 4.x).

At one point I looked into comparing the "termcap" database to the
"terminfo" database, but realized that I had no way of finding out
quickly what significance the differences had, if any; Sun has zillions
of various flavors of Wyse terminals, but it has few of any of the other
zillions of terminals in the databases.