Apple configured ncurses with termcap support (in addition to the default terminfo):
- config.status file showing the configure options.
- infocmp calls _nc_read_file_entry to obtain its data.
- tput calls setupterm, which goes to
_nc_read_entry, which calls
_nc_read_tic_entry, which does call
- if there's a problem in
_nc_read_entry falls back to the termcap support (see
Since that's ten-year-old code, the possible problem in _nc_read_tic_entry may have been fixed a while back.
For instance, I have MacPorts installed, and that works properly, while Apple's version does not. Here is a top-level script that I used to investigate the problem with:
infocmp -CrTt1 | grep -E ':..=.*:' | sed -e 's/^ ://' -e 's/=.*//' | xargs -n 1 /tmp/test-tput
infocmp -1 | grep -E '^ .*=.*,' | sed -e 's/^ //' -e 's/=.*//' | xargs -n 1 /tmp/test-tput
PATH to select between the two), and that called a second script
/tmp/test-tput to show the values:
tput "$1" >/dev/null 2>/dev/null || exit
echo -n "CAP:$1 "
tput "$1" 2>/dev/null
The behavior in ncurses 5.7 was a bug introduced in 1999
+ modify tput to accept termcap names as an alternative to terminfo
names (patch by Jeffrey C Honig).
and fixed in 2009:
+ change order of lookup in progs/tput.c, looking for terminfo data
first. This fixes a confusion between termcap "sg" and terminfo
"sgr" or "sgr0", originally from 990123 changes, but exposed by
20091114 fixes for hashing. With this change, only "dl" and "ed" are
ambiguous (Mandriva #56272).
Apple's ncurses 5.7 is about a year older than that fix.