Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Feb 2023 15:14:16 -0500
From:      Kurt Hackenberg <kh@panix.com>
To:        questions@freebsd.org
Subject:   Re: Cursing the tput utility - the penguin strikes again
Message-ID:  <Y/fJGCedB3Fk17xa@rain.cave>
In-Reply-To: <974a81c2-a92d-7f94-5f96-869bddfe21f3@fjl.co.uk>
References:  <974a81c2-a92d-7f94-5f96-869bddfe21f3@fjl.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 23, 2023 at 04:45:21PM +0000, Frank Leonhardt wrote:

>So there's a tput utility for controlling the terminal in BSD.
...
>Well use the tcap utility on non-BSD platforms and it suddenly doesn't
>work. It turns out that the penguinistas thought using the "Cap Name"
>instead of the "TCap Code" was a good idea. Some of the codes are the
>same, some are not. In fact most are not.

The trouble is those are two different mechanisms, based on two 
different file formats, that do the same thing.

The two file formats are "termcap" and "terminfo", both from the 
default names of the system files that use them. Manual section 5 has 
pages about both. They're similar, but different enough to be incompatible.

The "TCap codes" are the names used in termcap format; the "Capnames" 
are the names used in terminfo format. (A "cap" is a terminal "capability".)

I think termcap came first, and then somebody invented terminfo as an 
improvement or a reimplementation of the same idea. I think termcap 
came from Berkeley Unix -- maybe invented for vi -- so FreeBSD more or 
less stayed with it. Maybe terminfo came from Bell Labs; I think Linux 
prefers it.

This is pointlessly incompatible, the result of haphazard evolution, 
and kind of a mess. It's all about 40 years old.

The library functions that use those terminal descriptions were in the 
library "curses" (from "cursor"), long ago superseded by "ncurses" (new 
curses). Probably the program tput uses the library ncurses. You might 
want to look at that library; maybe there's a compatibility layer. Or, 
as Daniel Tameling suggested, maybe there are two different version of 
ncurses.



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