terminfo

Leslie Mikesell les at chinet.UUCP
Sat Sep 17 13:54:03 AEST 1988


In article <3194 at pegasus.UUCP> hansen at pegasus.UUCP (XT1554000-Tony L. Hansen;LZ 3B-315;3207) writes:

>Parsing the data file is not the only problem with termcap, however. The
>algorithm for searching for a given capability, after having parsed the
>entire entry into memory, is an n^2 algorithm. The search for each
>capability starts over again at the very beginning of the entry. Given that
>curses pulls in a large majority of the boolean, numeric and string
>capabilities, this searching for all of the capabilities overshadows the
>parsing of the data file.

Am I missing something here or couldn't this problem be solved by simply
grabbing everything you want in one pass through the termcap entry.  That
is, sort the list of capnames you want, find the first name from the
termcap entry, do a binary search on the list you want and grab the entry
if you need it.  This would not even require allocating storage for the
entire entry. And it would not preclude putting unknown names in the entry.

>You haven't been doing your homework. Benchmarks run by Mark Horton showed
>that the linear algorithms used by the terminfo library and doing a single
>read from the file system were considerably faster even than the use of a
>TERMCAP environment variable.

It probably doesn't take much to beat a linear search.  However, speed
isn't the whole issue here.  How about taking many times the disk space
(a significant difference on small machines), especially if you keep
the source files around, plus needing the compiler and decompiler. 

><> 5) I want to define my own capabilites
><> The user defined terminfo capabilities user0 to user9 were added in
><> SysVr3.1. You're free to do with these as you will.

Ok, suppose you have an assortment of machines ranging from SysVr2 to
SysVr3.2.  You can move the binaries around, but moving the binary
from an older release loses the new capabilities.  Moving a newer
release to an older will work, but if you decompile, modify and re-compile
you can't move it back without losing the new capabilities. 

>< 5a) I want my users to be able to change their terminfo entries quickly
>< and easily.

> [shell script to make a terminfo file deleted]

That was supposed to be an improvement over setting an
environment variable???

>And how do you usually edit your environment variable TERMCAP? Unless you
>have the ksh, you usually have to type it all in, do it via a separate
>program, or writing the variable to a temp file and using an editor such as
>vi on that temp file, then read the temp file back into your environment.

I would expect it to be done for you by the programs that want to
emulate some terminal type in a window or across a network.   I don't
see anything inherent in the terminfo capabilities that would have
prevented using a format compatible with environment entries. 

Les Mikesell



More information about the Comp.unix.wizards mailing list