Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Jun 2004 10:56:14 -0700
From:      Bill Campbell <freebsd@celestial.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: termcap vs terminfo
Message-ID:  <20040605175614.GA47256@alexis.mi.celestial.com>
In-Reply-To: <40C185CF.2020709@mail.ru>
References:  <40C185CF.2020709@mail.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jun 05, 2004, sigsegv@mail.ru wrote:
>I've noticed that the base system does not have terminfo, but instead 
>comes with termcap. Apparently BSD always had termcap and System V had 
>terminfo. I don't want to start a religious war as to which one is 
>better, but only want to ask if anyone has experienced problems when 
>porting ncurses applications from BSD to System V and vice versa, and 
>what could be done to minimise such problems.

First, you can install ncurses on FreeBSD so that's not a problem.

It's been many years since I first worked with termcap on a Tandy Model
16/6000 running Xenix.  I still have a couple of the early O'Reilly ``A
Nutshell Handbook: Reading and Writing Termcap Entries'' by John Strang
Copyright 1985 and Strang's ``Programming with Curses'' published at the
same time.

Terminfo came along a bit later from Bell Labs, and offered some extended
functionallity as well as some restriction not found in termcap.

Technically, they're both terminal capability databases.  The termcap data
file is simple ascii with two character attribute fields, and historically
has been limited to a maximum size of 1024 characters for any terminal
entry.  Termcap is extensible in that there aren't any hard-coded
attributes so the programmer can make up whatever suits the application.
Terminfo doesn't restrict the attribute names to two characters, is
compiled into a binary file for each terminal, and has never had the size
limit of termcap.  One of the downsides of terminfo is that the attributes
aren't as flexible as those of termcap so the programmer can't arbitrarily
define new ones as needed.  Before the advent of ncurses and other open
source terminfo implementations, this could be a serious problem.

My bottom line is that termcap is simpler to use for projects such as
printer descriptions where all I want is a simple way to define attributes,
and I can retrieve them using the standard termcap libraries in C or perl.
I've been using in a printer interface system for almost 20 years now where
I use termcap files to define printer capabilities for run-time conversion
depending on the type of printer.

When I'm working with real terminals, I'm more likely to be using ncurses
with terminfo since the work is largely done for me.

Bill
--
INTERNET:   bill@Celestial.COM  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``One of the common failings among honorable people is a failure to
appreciate how thoroughly dishonorable some other people can be, and how
dangerous it is to trust them.''
    - Thomas Sowell



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040605175614.GA47256>