Home | History | Annotate | only in /src/lib/libterminfo
History log of /src/lib/libterminfo
RevisionDateAuthorComments
 1.25 18-Sep-2025  mrg introduce a couple of new turn-off-gcc-warning variables and use them.

GCC 14 has a new annoying calloc() checker that we turn off in a bunch
of places, and there are a few more dangling-pointer issuse that come up,
but seem bogus.
 1.24 20-May-2024  martin Use double quotes to include the local ./Makefile.hash
 1.23 05-Apr-2020  roy terminfo: Add guards to optionally build parts of libterminfo

Reading from a database is now optional.
Compiling terminfo descriptions (including from $TERMINFO) is now optional.
Compat support is now optional.

This removes 17k on amd64 from the binary size, which allows it to be used
again on space constrained ramdisks.
 1.22 21-Mar-2012  matt branches: 1.22.32;
These directories default to WARNS?=5
 1.21 03-Nov-2011  joerg Fix dependencies on generated files.
 1.20 02-Nov-2011  yamt use the tools version of utilities for other scripts, too
 1.19 02-Nov-2011  christos Separate the generators out, so that they can be re-used by tools, and
don't play games with curdir/objdir.
 1.18 02-Nov-2011  roy branches: 1.18.2;
Now that nbperf can generate the same file using the -p option,
there is no longer a need to store these files in CVS.
 1.17 04-Oct-2011  roy Move longname(3) from curses to terminfo, pre-cursor to fix PR/43386.
 1.16 03-Oct-2011  roy Install correct man page links.
 1.15 03-Oct-2011  roy Correctly use ti_ instead of t_ for our extensions as per the man page.
Replace vtparm with tiparm.
tiparm is also non standard, but has been proposed at least.
 1.14 02-Oct-2011  roy Add termname(3) as defined by POSIX.
 1.13 16-Aug-2011  christos document non-literal format strings
 1.12 06-Jul-2010  mrg remove almost all the ability to build netbsd with an a.out target.
we're ELF now, and there are many missing checks against OBJECT_FMT.
if we ever consider switching, the we can figure out what new ones
we need but for now it's just clutter.

this doesn't remove any of the support for exec_aout or any actually
required-for-boot a.out support, only the ability to build a netbsd
release in a.out format. ie, most of this code has been dead for
over a decade.

i've tested builds on vax, amd64, i386, mac68k, macppc, sparc, atari,
amiga, shark, cats, dreamcast, landisk, mmeye and x68k. this covers
the 5 MACHINE_ARCH's affected, and all the other arch code touched.
it also includes some actual run-time testing of sparc, i386 and
shark, and i performed binary comparison upon amiga and x68k as well.


some minor details relevant:
- move shlib.[ch] from ld.aout_so into ldconfig proper, and cut them
down to only the parts ldconfig needs
- remove various unused source files
- switch amiga bootblocks to using elf2bb.h instead of aout2bb.h
 1.11 22-Feb-2010  roy libterminfo can now compile a single terminfo description which allows
$TERMINFO to be a terminfo description as well as a file reference.

This enables the user to modify the terminfo description on read-only
media.
 1.10 19-Feb-2010  njoly Do clean generated terminfo.5 file.
 1.9 12-Feb-2010  roy Store the generated compiled terminfo descriptions so that we can build
a consistent library just from source.
 1.8 11-Feb-2010  roy Include xterm.
 1.7 11-Feb-2010  roy Use $TOOL_TIC
 1.6 11-Feb-2010  roy Use structures so we know how long each description is.
 1.5 11-Feb-2010  roy Embed ansi, dumb, vt100, vt220 and wsvt25 compiled terminal descriptions
into libterminfo.
Constify some foo.
 1.4 09-Feb-2010  roy We should always generate terminfo.5 to save human error syncing.
 1.3 03-Feb-2010  roy Store our generated files in CVS and remove nbperf from the toolchain.
This allows us to build consistent libs without an ever changing hash.
 1.2 03-Feb-2010  roy Use $HOST_SH instead of calling directly.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.18.2.2 17-Apr-2012  yamt sync with head
 1.18.2.1 10-Nov-2011  yamt sync with head
 1.22.32.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7 24-Jan-2013  roy Fix building our terminals with a non standard NETBSDSRCDIR, PR lib/46793.
Thanks to Bernd Ernesti.
 1.6 20-Aug-2012  joerg branches: 1.6.2;
Add tic dependency only for the USETOOLS case.
 1.5 03-Jun-2012  joerg Switch terminfo(3) to cdb(5).
 1.4 03-Nov-2011  joerg branches: 1.4.2; 1.4.4;
Fix dependencies on generated files.
 1.3 02-Nov-2011  yamt use the tools version of utilities for other scripts, too
 1.2 02-Nov-2011  christos use the tools version.
 1.1 02-Nov-2011  christos Separate the generators out, so that they can be re-used by tools, and
don't play games with curdir/objdir.
 1.4.4.2 14-Mar-2013  riz Pull up following revision(s) (requested by roy in ticket #835):
lib/libterminfo/terminfo.3: revision 1.9
lib/libterminfo/term.h: revision 1.13
lib/libterminfo/term.h: revision 1.14
usr.bin/tput/Makefile: revision 1.11
lib/libterminfo/terminfo.3: revision 1.10
lib/libterminfo/genman: revision 1.5
lib/libterminfo/term_private.h: revision 1.11
usr.bin/tput/tput.c: revision 1.23
usr.bin/tput/tput.c: revision 1.24
usr.bin/tput/tput.c: revision 1.25
lib/libterminfo/tparm.c: revision 1.11
lib/libterminfo/Makefile.hash: revision 1.7
usr.bin/tput/tput.c: revision 1.26
lib/libterminfo/tparm.c: revision 1.12
lib/libterminfo/tparm.c: revision 1.13
lib/libterminfo/tparm.c: revision 1.14
lib/libterminfo/terminfo.5.in: revision 1.18
As tparm accepts longs we should treat them as long during expansion.
Also, fix the ~ and ! logic.
Move the strings vs long analysis to a private function, but allow
tput(1) to use it so we can work with string parameters to
capabilities.
Fix building our terminals with a non standard NETBSDSRCDIR, PR
lib/46793.
Thanks to Bernd Ernesti.
Remove debug accidently commited.
If char * > long then print a suitable error when passing a string
parameter.
For platforms where we cannot fit a char * into a long, return NULL
and set errno to ENOTSUPP.
Add descriptions for terminfo keys to term.h
These are extracted by genman and placed into the compiled terminfo.5
Fixes PR lib/47090
Provide a disabled implentation of tlparm and ti_tlparm for
completeness.
This also improves the readability of _ti_tiparm.
Use putp(3) to output our strings.
Fixes PR lib/47532
 1.4.4.1 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.4.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.2.3 30-Oct-2012  yamt sync with head
 1.4.2.2 10-Nov-2011  yamt sync with head
 1.4.2.1 03-Nov-2011  yamt file Makefile.hash was added on branch yamt-pagecache on 2011-11-10 14:31:37 +0000
 1.6.2.1 25-Feb-2013  tls resync with head
 1.1 26-Mar-2013  agc branches: 1.1.2;
file Version.map was initially added on branch agc-symver.
 1.1.2.1 26-Mar-2013  agc Add symbol versioning information for libterminfo.

Obvious (but interesting) aspect of this library: ospeed, PC, and
BC also need to be exported as global symbols or they are not found
at link time.
 1.26 21-Jun-2020  roy libterminfo: cast to uint16/32_t before conversion to preserve negativity

Otherwise the ABSENT_NUMERIC(-1) or CANCELLED_NUMERIC(-2) will be converted
incorrectly to size_t and then down to uint16/32_t.
Picked up by DIAGNOSTIC builds.

Thanks to Michael Forney for the fix for PR lib/52293.
 1.25 05-Apr-2020  roy terminfo: Add guards to optionally build parts of libterminfo

Reading from a database is now optional.
Compiling terminfo descriptions (including from $TERMINFO) is now optional.
Compat support is now optional.

This removes 17k on amd64 from the binary size, which allows it to be used
again on space constrained ramdisks.
 1.24 30-Mar-2020  roy terminfo: satisfy gcc bitching
 1.23 30-Mar-2020  roy terminfo: v3 records should create v3 aliases
 1.22 29-Mar-2020  roy terminfo: Promote a terminfo description to v3 when required

Blindly scanning the capabilities for # and checking that the following
number is bigger than a short isn't reliable because this could be a
string value:

SomeString#1234

Instead, if we process the numeric as normal and if it's value is too big
for v1 then promote the record to v3.
 1.21 29-Mar-2020  roy terminfo: allow _ti_getname to convert from and to any version
 1.20 28-Mar-2020  christos PR/55118: Andreas Gustafsson: Oops, set the right flag variable.
 1.19 28-Mar-2020  roy terminfo: Add a comment for prior change.
 1.18 28-Mar-2020  roy terminfo: use , as a record version delimiter rather than @

@ is allowed in a terminfo description, but a comma is not.
 1.17 28-Mar-2020  christos support for older compilers
 1.16 27-Mar-2020  christos Introduce a bunch of inline functions and utilities to avoid code duplication.
 1.15 27-Mar-2020  christos As described in tech-userlevel:
- Modify the writing code to only write entries in the new
format for the terminal descriptions that require it.
- Store new format entries as <name>@v3
- Store old format entries with clamped values as <name> for
backwards compatibility
- Lookup first <name>@v3 and then <name> if that is not found.
- Don't create terminfo2 anymore; old programs keep working with
clamped entries, and new programs be able to use the wide
fields with using the original db file.
 1.14 13-Mar-2020  roy terminfo: promote numeric parameters from short to int

POSIX mandates implementations must support upto a short but may exceed it.
When NetBSD terminfo was implemented, no terminfo description used over
a short, but because ncurses has supported ints for some time, some now do.

Infact, such a terminfo description was imported where colour pairs for
screen-256color went up to 65536 which exposed a bug in the existing
implementation where it set to zero. Because the number might mean
something more than a range, we need to be able to store it accurately.

This requires a version bump because whilst the API hasn't changed thanks
to C int promotion, the ABI has. Also the underlying database structure
has changed as well - we now store the numeric paramter inside a uint32_t
field rather than a uint16_t one.
Whilst this change can still read the old style database, the old one
cannot read the new one and thus we now maintain the database as
terminfo2.cdb, leaving the old library and database alone so old programs
still work fine.

libcurses, libfrom, libmenu and libpanel have also been bumped to
accomoate this change.
 1.13 12-Mar-2020  roy terminfo: truncate numeric parameters to a short

Because that is what our API demands.
We should probably change to int when we next bump the API.
 1.12 04-May-2017  roy branches: 1.12.10;
Clean up some more warnings.
 1.11 11-Feb-2017  roy branches: 1.11.2;
Warn about unprintable characters in capability strings.
 1.10 11-Feb-2017  roy Following a newline, strip leading whitespace from capability strings.
 1.9 07-Jun-2013  roy branches: 1.9.10; 1.9.14;
Whitespace
 1.8 03-Jun-2012  joerg branches: 1.8.2;
Switch terminfo(3) to cdb(5).
 1.7 01-Jun-2012  joerg Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
 1.6 28-Nov-2011  joerg branches: 1.6.2;
Kill a bunch of manual __attribute__ usages and replace them with the
equivalent sys/cdefs.h invocation.
 1.5 11-Apr-2011  roy branches: 1.5.4;
Clean up some compile warnings
 1.4 02-Mar-2010  roy Use _ti_get_token instead of strsep when parsing termcap entries.
This allows us to handle \E\ as a valid sequence.
 1.3 01-Mar-2010  dholland compile.c needs sys/endian.h; PR 42875 from Henning Petersen.
 1.2 25-Feb-2010  roy If we only have a name then we flatten to an alias.
 1.1 22-Feb-2010  roy libterminfo can now compile a single terminfo description which allows
$TERMINFO to be a terminfo description as well as a file reference.

This enables the user to modify the terminfo description on read-only
media.
 1.5.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.4.2 30-Oct-2012  yamt sync with head
 1.5.4.1 17-Apr-2012  yamt sync with head
 1.6.2.1 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.8.2.1 23-Jun-2013  tls resync from head
 1.9.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.9.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.11.2.1 11-May-2017  pgoyette Sync with HEAD
 1.12.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3 02-Nov-2011  roy Now that nbperf can generate the same file using the -p option,
there is no longer a need to store these files in CVS.
 1.2 19-Jun-2011  roy Make new compiled terms for our updated terminfo.
 1.1 12-Feb-2010  roy branches: 1.1.4;
Store the generated compiled terminfo descriptions so that we can build
a consistent library just from source.
 1.1.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.14 30-May-2020  roy terminfo: test strlcpy result against space free, not string length

riastradh@ yep, looks good.
 1.13 04-May-2017  roy branches: 1.13.2; 1.13.12;
Clean up some compile warnings.
 1.12 01-Apr-2016  christos branches: 1.12.6;
- if we are freeing cur_term, set it to NULL.
- preserve and free "last" properly.

$ cat foo.c
#include <stdio.h>
#include <termcap.h>

int
main(void)
{
tgetent(NULL, "dumb");
tgetent(NULL, "network");
tgetflag("so");
return 0;
}
$ cc foo.c -lterminfo
$ MALLOC_OPTIONS=J ./a.out
Boom.

XXX: pullup-7
 1.11 25-Nov-2015  christos PR/50092: Fix memory leak.
 1.10 18-Nov-2013  joerg branches: 1.10.4; 1.10.8;
Use an empty string, not a null pointer for nullname.
 1.9 07-Jun-2013  roy Whitespace
 1.8 05-Oct-2011  roy branches: 1.8.2; 1.8.8;
There is no standard way of getting a list of aliases for the
terminal. However, some applications such as telnet want to know this.
ncurses dumps the terminfo header into an undefined variable ttytype
and these applications then parse it to work out the aliases.
We should do the same for now, until a standard mechanism for getting
the information is available or the need for it goes away.
 1.7 04-Oct-2011  roy Move longname(3) from curses to terminfo, pre-cursor to fix PR/43386.
 1.6 03-Oct-2011  roy Remove _ti_freeterm as consumers should just use del_curterm.
 1.5 02-Oct-2011  roy Add termname(3) as defined by POSIX.
 1.4 22-Feb-2010  roy libterminfo can now compile a single terminfo description which allows
$TERMINFO to be a terminfo description as well as a file reference.

This enables the user to modify the terminfo description on read-only
media.
 1.3 11-Feb-2010  roy Remove silly debug.
 1.2 11-Feb-2010  roy Embed ansi, dumb, vt100, vt220 and wsvt25 compiled terminal descriptions
into libterminfo.
Constify some foo.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.8.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.8.1 23-Jun-2013  tls resync from head
 1.8.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.8.1 18-Jan-2017  skrll Sync with netbsd-5
 1.10.4.1 12-Dec-2016  snj Pull up following revision(s) (requested by riastradh in ticket #1307):
lib/libterminfo/curterm.c: revisions 1.11, 1.12
lib/libterminfo/term.c: revisions 1.18-1.20
lib/libterminfo/termcap.c: revisions 1.18, 1.19
lib/libterminfo/terminfo.3: revision 1.13
lib/libterminfo/tparm.c: revision 1.16
terminfo.3: fix ti_puts prototype
--
PR/50092: Fix memory leak.
--
PR/50092: Rin Okuyama: Fix memory leak.
--
We have the max length; use snprintf.
--
From PR/50092:
- handle calling _ti_readterm with an existing initialized terminal
- simplify free code
Also:
- fix an inconsistency in userdefs count computation
--
Always copy the area buffer, even when the length was the same
(from Rin Okuyama)
--
- if we are freeing cur_term, set it to NULL.
- preserve and free "last" properly.
--
off-by-one in memcpy. Found by ASAN (Carsten Kunze)
 1.12.6.1 11-May-2017  pgoyette Sync with HEAD
 1.13.12.1 31-May-2020  martin Pull up following revision(s) (requested by roy in ticket #936):

lib/libterminfo/curterm.c: revision 1.14

terminfo: test strlcpy result against space free, not string length

riastradh@ yep, looks good.
 1.13.2.1 31-May-2020  martin Pull up following revision(s) (requested by roy in ticket #1552):

lib/libterminfo/curterm.c: revision 1.14

terminfo: test strlcpy result against space free, not string length

riastradh@ yep, looks good.
 1.9 11-Jan-2017  roy Fix some off by one issues with arraycount ..thanks coypu.
 1.8 02-Nov-2011  roy branches: 1.8.24;
Now that nbperf can generate the same file using the -p option,
there is no longer a need to store these files in CVS.
 1.7 12-Oct-2010  christos replace `` with $(). Hopefully with enough examples around people will
forget about ``.
 1.6 03-Mar-2010  roy Abort an error.
 1.5 04-Feb-2010  roy Allow hash to be build on other hosts.
 1.4 04-Feb-2010  roy Fix build issues on other hosts.
 1.3 03-Feb-2010  roy Store our generated files in CVS and remove nbperf from the toolchain.
This allows us to build consistent libs without an ever changing hash.
 1.2 03-Feb-2010  snj Fix some typos and spelling errors.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.8.24.1 20-Mar-2017  pgoyette Sync with HEAD
 1.6 05-Apr-2024  christos From Jan-Benedict Glaw:

Use `printf` instead of `echo` for precise output

`man` pages generated under NetBSD and Linux differ as the escape codes
may or may not be interpreted when going through those two chained `echo`es.
Instead just use `printf`, which produces the desired output, always.
 1.5 25-Jan-2013  roy Add descriptions for terminfo keys to term.h
These are extracted by genman and placed into the compiled terminfo.5
Fixes PR lib/47090
 1.4 12-Oct-2010  christos branches: 1.4.6; 1.4.8; 1.4.12;
replace `` with $(). Hopefully with enough examples around people will
forget about ``.
 1.3 03-Mar-2010  roy Abort an error.
 1.2 03-Feb-2010  roy Store our generated files in CVS and remove nbperf from the toolchain.
This allows us to build consistent libs without an ever changing hash.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.4.12.1 25-Feb-2013  tls resync with head
 1.4.8.1 14-Mar-2013  riz Pull up following revision(s) (requested by roy in ticket #835):
lib/libterminfo/terminfo.3: revision 1.9
lib/libterminfo/term.h: revision 1.13
lib/libterminfo/term.h: revision 1.14
usr.bin/tput/Makefile: revision 1.11
lib/libterminfo/terminfo.3: revision 1.10
lib/libterminfo/genman: revision 1.5
lib/libterminfo/term_private.h: revision 1.11
usr.bin/tput/tput.c: revision 1.23
usr.bin/tput/tput.c: revision 1.24
usr.bin/tput/tput.c: revision 1.25
lib/libterminfo/tparm.c: revision 1.11
lib/libterminfo/Makefile.hash: revision 1.7
usr.bin/tput/tput.c: revision 1.26
lib/libterminfo/tparm.c: revision 1.12
lib/libterminfo/tparm.c: revision 1.13
lib/libterminfo/tparm.c: revision 1.14
lib/libterminfo/terminfo.5.in: revision 1.18
As tparm accepts longs we should treat them as long during expansion.
Also, fix the ~ and ! logic.
Move the strings vs long analysis to a private function, but allow
tput(1) to use it so we can work with string parameters to
capabilities.
Fix building our terminals with a non standard NETBSDSRCDIR, PR
lib/46793.
Thanks to Bernd Ernesti.
Remove debug accidently commited.
If char * > long then print a suitable error when passing a string
parameter.
For platforms where we cannot fit a char * into a long, return NULL
and set errno to ENOTSUPP.
Add descriptions for terminfo keys to term.h
These are extracted by genman and placed into the compiled terminfo.5
Fixes PR lib/47090
Provide a disabled implentation of tlparm and ti_tlparm for
completeness.
This also improves the readability of _ti_tiparm.
Use putp(3) to output our strings.
Fixes PR lib/47532
 1.4.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4 02-Nov-2011  roy Now that nbperf can generate the same file using the -p option,
there is no longer a need to store these files in CVS.
 1.3 12-Oct-2010  christos replace `` with $(). Hopefully with enough examples around people will
forget about ``.
 1.2 03-Mar-2010  roy Abort an error.
 1.1 12-Feb-2010  roy Store the generated compiled terminfo descriptions so that we can build
a consistent library just from source.
 1.5 02-Nov-2011  roy Now that nbperf can generate the same file using the -p option,
there is no longer a need to store these files in CVS.
 1.4 03-Mar-2010  roy Abort an error.
 1.3 04-Feb-2010  roy Fix build issues on other hosts.
 1.2 03-Feb-2010  roy Store our generated files in CVS and remove nbperf from the toolchain.
This allows us to build consistent libs without an ever changing hash.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.5 02-Nov-2011  roy Now that nbperf can generate the same file using the -p option,
there is no longer a need to store these files in CVS.
 1.4 12-Feb-2010  roy Don't try to map obsolete termcap bc and nl to terminfo.
 1.3 04-Feb-2010  roy Allow hash to be build on other hosts.
 1.2 04-Feb-2010  roy Fix build issues on other hosts.
 1.1 03-Feb-2010  roy Store our generated files in CVS and remove nbperf from the toolchain.
This allows us to build consistent libs without an ever changing hash.
 1.9 11-Apr-2019  jakllsch fix typo in error message; database is spelled with one 'b' and three 'a's
 1.8 04-May-2017  roy branches: 1.8.10;
Clean up some compile warnings.
 1.7 23-Mar-2017  roy branches: 1.7.2;
POSIX says that use_env(3) must precede setupterm(3).
The former lives in curses.h, but the latter lives in term.h.

This is solved by moving the function to libterminfo.
Because the environment can affect the terminal capabilities for
lines and columns, it follows that the tty size should affect it to.
So move that code to libterminfo and adjust in libcurses.
 1.6 23-Mar-2017  roy Revert botched commit.
 1.5 23-Mar-2017  roy term.h
 1.4 07-Jun-2013  roy branches: 1.4.10; 1.4.14;
Whitespace
 1.3 03-Oct-2011  roy branches: 1.3.2; 1.3.8;
Remove _ti_freeterm as consumers should just use del_curterm.
 1.2 11-Feb-2010  roy Embed ansi, dumb, vt100, vt220 and wsvt25 compiled terminal descriptions
into libterminfo.
Constify some foo.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.3.8.1 23-Jun-2013  tls resync from head
 1.3.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.4.10.1 26-Apr-2017  pgoyette Sync with HEAD
 1.7.2.1 11-May-2017  pgoyette Sync with HEAD
 1.8.10.1 10-Jun-2019  christos Sync with HEAD
 1.2 13-Mar-2020  roy terminfo: promote numeric parameters from short to int

POSIX mandates implementations must support upto a short but may exceed it.
When NetBSD terminfo was implemented, no terminfo description used over
a short, but because ncurses has supported ints for some time, some now do.

Infact, such a terminfo description was imported where colour pairs for
screen-256color went up to 65536 which exposed a bug in the existing
implementation where it set to zero. Because the number might mean
something more than a range, we need to be able to store it accurately.

This requires a version bump because whilst the API hasn't changed thanks
to C int promotion, the ABI has. Also the underlying database structure
has changed as well - we now store the numeric paramter inside a uint32_t
field rather than a uint16_t one.
Whilst this change can still read the old style database, the old one
cannot read the new one and thus we now maintain the database as
terminfo2.cdb, leaving the old library and database alone so old programs
still work fine.

libcurses, libfrom, libmenu and libpanel have also been bumped to
accomoate this change.
 1.1 03-Feb-2010  roy branches: 1.1.46;
Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.1.46.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.34 05-Apr-2020  martin Conditionalize a few more functions (hopefully fixing the build)
 1.33 05-Apr-2020  roy terminfo: Add guards to optionally build parts of libterminfo

Reading from a database is now optional.
Compiling terminfo descriptions (including from $TERMINFO) is now optional.
Compat support is now optional.

This removes 17k on amd64 from the binary size, which allows it to be used
again on space constrained ramdisks.
 1.32 27-Mar-2020  christos Introduce a bunch of inline functions and utilities to avoid code duplication.
 1.31 27-Mar-2020  christos As described in tech-userlevel:
- Modify the writing code to only write entries in the new
format for the terminal descriptions that require it.
- Store new format entries as <name>@v3
- Store old format entries with clamped values as <name> for
backwards compatibility
- Lookup first <name>@v3 and then <name> if that is not found.
- Don't create terminfo2 anymore; old programs keep working with
clamped entries, and new programs be able to use the wide
fields with using the original db file.
 1.30 13-Mar-2020  roy terminfo: promote numeric parameters from short to int

POSIX mandates implementations must support upto a short but may exceed it.
When NetBSD terminfo was implemented, no terminfo description used over
a short, but because ncurses has supported ints for some time, some now do.

Infact, such a terminfo description was imported where colour pairs for
screen-256color went up to 65536 which exposed a bug in the existing
implementation where it set to zero. Because the number might mean
something more than a range, we need to be able to store it accurately.

This requires a version bump because whilst the API hasn't changed thanks
to C int promotion, the ABI has. Also the underlying database structure
has changed as well - we now store the numeric paramter inside a uint32_t
field rather than a uint16_t one.
Whilst this change can still read the old style database, the old one
cannot read the new one and thus we now maintain the database as
terminfo2.cdb, leaving the old library and database alone so old programs
still work fine.

libcurses, libfrom, libmenu and libpanel have also been bumped to
accomoate this change.
 1.29 08-Oct-2018  roy terminfo: if $TERMINFO.cdb doesn't exist, try $TERMINFO

This allows this command sequence to work:
tic -o /tmp/foo foo
TERMINFO=/tmp/foo TERM=foo infocmp
 1.28 16-May-2017  roy branches: 1.28.8; 1.28.10;
Improve the scope of some variables.
 1.27 16-May-2017  roy Remove ticcmp and extend _ti_checkname so it can be used instead.
 1.26 16-May-2017  roy Fix prior for multiple terminfo aliases.
 1.25 16-May-2017  roy Instead of poking in the binary blob to work out if this is our terminal,
assume it is and load it.
Once loaded then check it's really for us.
This allows us to work out if the indexed alias entry is correct we
this was not checked previously.
 1.24 16-May-2017  roy Don't bother allocating space for the database name, just print
directly to the static buffer storage.
 1.23 16-May-2017  roy Move pathbuf into the function where it's actually used.
 1.22 04-May-2017  roy Clean up some compile warnings.
 1.21 20-Apr-2017  roy branches: 1.21.2;
Whitespace, fit in 80 and extra braces for readability.
No functional change.
 1.20 24-Nov-2016  christos branches: 1.20.2;
off-by-one in memcpy. Found by ASAN (Carsten Kunze)
XXX: pullup 7.
 1.19 26-Nov-2015  christos branches: 1.19.2;
Always copy the area buffer, even when the length was the same
(from Rin Okuyama)
 1.18 25-Nov-2015  christos From PR/50092:
- handle calling _ti_readterm with an existing initialized terminal
- simplify free code
Also:
- fix an inconsistency in userdefs count computation
 1.17 07-Jun-2013  roy branches: 1.17.6; 1.17.10;
Whitespace
 1.16 06-Jun-2012  joerg branches: 1.16.2;
Relax consistency to make it possible to match valid entries.
 1.15 03-Jun-2012  joerg Switch terminfo(3) to cdb(5).
 1.14 01-Jun-2012  joerg Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
 1.13 03-Oct-2011  roy branches: 1.13.2; 1.13.4;
Remove _ti_freeterm as consumers should just use del_curterm.
 1.12 11-Apr-2011  roy Clean up some compile warnings
 1.11 26-Feb-2010  roy Implement captoinfo so that we can convert $TERMCAP into $TERMINFO.
We don't currently map %> %B %D.
That means no conversion for regent100, hz1500, act4, act5, mime terms.
 1.10 22-Feb-2010  roy libterminfo can now compile a single terminfo description which allows
$TERMINFO to be a terminfo description as well as a file reference.

This enables the user to modify the terminfo description on read-only
media.
 1.9 12-Feb-2010  roy Store the generated compiled terminfo descriptions so that we can build
a consistent library just from source.
 1.8 11-Feb-2010  roy Respect TERMINFO_DIRS and document using an embedded database.
 1.7 11-Feb-2010  roy Use structures so we know how long each description is.
 1.6 11-Feb-2010  roy Allow a NULL description.
 1.5 11-Feb-2010  roy Embed ansi, dumb, vt100, vt220 and wsvt25 compiled terminal descriptions
into libterminfo.
Constify some foo.
 1.4 05-Feb-2010  roy Don't look in /etc for a terminfo database.
Don't report the rescue database if we did not find the terminal in
there AND we were able to access prior databases.
 1.3 05-Feb-2010  roy Store the aliases against the entry, so that infocmp can reproduce them.
Handy for creating smaller terminfo databases.
 1.2 05-Feb-2010  roy Allow loading of a terminfo database in /rescue.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.13.4.1 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.13.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.2.1 30-Oct-2012  yamt sync with head
 1.16.2.1 23-Jun-2013  tls resync from head
 1.17.10.1 18-Jan-2017  skrll Sync with netbsd-5
 1.17.6.1 12-Dec-2016  snj Pull up following revision(s) (requested by riastradh in ticket #1307):
lib/libterminfo/curterm.c: revisions 1.11, 1.12
lib/libterminfo/term.c: revisions 1.18-1.20
lib/libterminfo/termcap.c: revisions 1.18, 1.19
lib/libterminfo/terminfo.3: revision 1.13
lib/libterminfo/tparm.c: revision 1.16
terminfo.3: fix ti_puts prototype
--
PR/50092: Fix memory leak.
--
PR/50092: Rin Okuyama: Fix memory leak.
--
We have the max length; use snprintf.
--
From PR/50092:
- handle calling _ti_readterm with an existing initialized terminal
- simplify free code
Also:
- fix an inconsistency in userdefs count computation
--
Always copy the area buffer, even when the length was the same
(from Rin Okuyama)
--
- if we are freeing cur_term, set it to NULL.
- preserve and free "last" properly.
--
off-by-one in memcpy. Found by ASAN (Carsten Kunze)
 1.19.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.19.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.20.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.21.2.2 19-May-2017  pgoyette Resolve conflicts from previous merge (all resulting from $NetBSD
keywork expansion)
 1.21.2.1 11-May-2017  pgoyette Sync with HEAD
 1.28.10.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.28.10.1 10-Jun-2019  christos Sync with HEAD
 1.28.8.1 20-Oct-2018  pgoyette Sync with head
 1.26 11-May-2022  andvar fix various typos in comments.
 1.25 10-Dec-2021  andvar s/occured/occurred/ in comments, log messages and man pages.
 1.24 05-Jun-2020  roy terminfo(5): Numbre -> Number

Thanks to yukonbob
 1.23 13-Mar-2020  roy terminfo: promote numeric parameters from short to int

POSIX mandates implementations must support upto a short but may exceed it.
When NetBSD terminfo was implemented, no terminfo description used over
a short, but because ncurses has supported ints for some time, some now do.

Infact, such a terminfo description was imported where colour pairs for
screen-256color went up to 65536 which exposed a bug in the existing
implementation where it set to zero. Because the number might mean
something more than a range, we need to be able to store it accurately.

This requires a version bump because whilst the API hasn't changed thanks
to C int promotion, the ABI has. Also the underlying database structure
has changed as well - we now store the numeric paramter inside a uint32_t
field rather than a uint16_t one.
Whilst this change can still read the old style database, the old one
cannot read the new one and thus we now maintain the database as
terminfo2.cdb, leaving the old library and database alone so old programs
still work fine.

libcurses, libfrom, libmenu and libpanel have also been bumped to
accomoate this change.
 1.22 23-Mar-2017  roy branches: 1.22.12;
Allow terminfo users to update flag and numeric capabilities as they do
strings.
 1.21 23-Mar-2017  roy Revert botched commit.
 1.20 23-Mar-2017  roy term.h
 1.19 23-Mar-2017  roy Revert prior .... some ncurses application expect to be able to update
the terminal capabilities.
 1.18 20-Mar-2017  roy Ensure there is a terminal to return capabilities from.
 1.17 12-Jan-2017  roy branches: 1.17.2;
Correct terminfo variable pkey_norm to plab_norm.
 1.16 07-Jun-2013  roy branches: 1.16.10;
Whitespace
 1.15 15-Mar-2013  njoly Fix c&p error in string descriptions.
 1.14 25-Jan-2013  roy Provide a disabled implentation of tlparm and ti_tlparm for completeness.
This also improves the readability of _ti_tiparm.
 1.13 25-Jan-2013  roy Add descriptions for terminfo keys to term.h
These are extracted by genman and placed into the compiled terminfo.5
Fixes PR lib/47090
 1.12 29-May-2012  dholland branches: 1.12.2;
Add cdefs.h per PR 46492.
 1.11 22-Feb-2012  christos PR/46075: Asau: fix typo set_color_paid -> set_color_pair
 1.10 04-Oct-2011  roy branches: 1.10.2; 1.10.4;
Move longname(3) from curses to terminfo, pre-cursor to fix PR/43386.
 1.9 03-Oct-2011  roy Correctly use ti_ instead of t_ for our extensions as per the man page.
Replace vtparm with tiparm.
tiparm is also non standard, but has been proposed at least.
 1.8 02-Oct-2011  roy Add termname(3) as defined by POSIX.
 1.7 11-Apr-2011  roy POSIX says that term.h should define tgetstr and friends
Fixes PR lib/43941
 1.6 22-Sep-2010  roy Our API just uses typedefs, so don't use the struct symbol which will avoid
any potential conflicts with userland.
 1.5 26-Feb-2010  roy Implement captoinfo so that we can convert $TERMCAP into $TERMINFO.
We don't currently map %> %B %D.
That means no conversion for regent100, hz1500, act4, act5, mime terms.
 1.4 11-Feb-2010  roy Embed ansi, dumb, vt100, vt220 and wsvt25 compiled terminal descriptions
into libterminfo.
Constify some foo.
 1.3 05-Feb-2010  he More adaptation for ports with unsigned char as char.
 1.2 04-Feb-2010  roy Fix build issues on other hosts.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.10.4.3 14-Mar-2013  riz Pull up following revision(s) (requested by roy in ticket #835):
lib/libterminfo/terminfo.3: revision 1.9
lib/libterminfo/term.h: revision 1.13
lib/libterminfo/term.h: revision 1.14
usr.bin/tput/Makefile: revision 1.11
lib/libterminfo/terminfo.3: revision 1.10
lib/libterminfo/genman: revision 1.5
lib/libterminfo/term_private.h: revision 1.11
usr.bin/tput/tput.c: revision 1.23
usr.bin/tput/tput.c: revision 1.24
usr.bin/tput/tput.c: revision 1.25
lib/libterminfo/tparm.c: revision 1.11
lib/libterminfo/Makefile.hash: revision 1.7
usr.bin/tput/tput.c: revision 1.26
lib/libterminfo/tparm.c: revision 1.12
lib/libterminfo/tparm.c: revision 1.13
lib/libterminfo/tparm.c: revision 1.14
lib/libterminfo/terminfo.5.in: revision 1.18
As tparm accepts longs we should treat them as long during expansion.
Also, fix the ~ and ! logic.
Move the strings vs long analysis to a private function, but allow
tput(1) to use it so we can work with string parameters to
capabilities.
Fix building our terminals with a non standard NETBSDSRCDIR, PR
lib/46793.
Thanks to Bernd Ernesti.
Remove debug accidently commited.
If char * > long then print a suitable error when passing a string
parameter.
For platforms where we cannot fit a char * into a long, return NULL
and set errno to ENOTSUPP.
Add descriptions for terminfo keys to term.h
These are extracted by genman and placed into the compiled terminfo.5
Fixes PR lib/47090
Provide a disabled implentation of tlparm and ti_tlparm for
completeness.
This also improves the readability of _ti_tiparm.
Use putp(3) to output our strings.
Fixes PR lib/47532
 1.10.4.2 11-Jun-2012  riz Pull up following revision(s) (requested by dholland in ticket #292):
lib/libterminfo/term.h: revision 1.12
Add cdefs.h per PR 46492.
 1.10.4.1 24-Feb-2012  riz Pull up following revision(s) (requested by asau in ticket #42):
lib/libterminfo/term.h: revision 1.11
PR/46075: Asau: fix typo set_color_paid -> set_color_pair
 1.10.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.2.2 30-Oct-2012  yamt sync with head
 1.10.2.1 17-Apr-2012  yamt sync with head
 1.12.2.2 23-Jun-2013  tls resync from head
 1.12.2.1 25-Feb-2013  tls resync with head
 1.16.10.2 26-Apr-2017  pgoyette Sync with HEAD
 1.16.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.17.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.22.12.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.22 23-Sep-2025  js Also include "nbtool_config.h" if HAVE_NBTOOL_CONFIG_H is defined
 1.21 23-Sep-2025  js Wrap <sys/endian.h> include in #ifdef HAVE_SYS_ENDIAN_H

The real issue is that on Darwin, <sys/endian.h> does exist and has be16dec and
friends. However, since they do exist, they are not declared by
"compat_defs.h". Therefore, if <sys/endian.h> exists, we need to include it. In
case <sys/endian.h> does not have be16dec and friends, including it is harmless
and "compat_defs.h" will declare them. And if we don't have <sys/endian.h>,
they are always declared by "compat_defs.h", as the configure check depends on
<sys/endian.h>.
 1.20 23-Sep-2025  js Add missing include to fix building on Darwin
 1.19 21-Jun-2020  roy libterminfo: cast to uint16/32_t before conversion to preserve negativity

Otherwise the ABSENT_NUMERIC(-1) or CANCELLED_NUMERIC(-2) will be converted
incorrectly to size_t and then down to uint16/32_t.
Picked up by DIAGNOSTIC builds.

Thanks to Michael Forney for the fix for PR lib/52293.
 1.18 29-Mar-2020  roy terminfo: Promote a terminfo description to v3 when required

Blindly scanning the capabilities for # and checking that the following
number is bigger than a short isn't reliable because this could be a
string value:

SomeString#1234

Instead, if we process the numeric as normal and if it's value is too big
for v1 then promote the record to v3.
 1.17 29-Mar-2020  roy terminfo: allow _ti_getname to convert from and to any version
 1.16 29-Mar-2020  roy terminfo: Clamp numeric bounds to storage not API.

While here, fix decoding of numeric -1 stored in uint16_t to still be -1.
 1.15 28-Mar-2020  roy Whitespace
 1.14 27-Mar-2020  christos Introduce a bunch of inline functions and utilities to avoid code duplication.
 1.13 27-Mar-2020  christos As described in tech-userlevel:
- Modify the writing code to only write entries in the new
format for the terminal descriptions that require it.
- Store new format entries as <name>@v3
- Store old format entries with clamped values as <name> for
backwards compatibility
- Lookup first <name>@v3 and then <name> if that is not found.
- Don't create terminfo2 anymore; old programs keep working with
clamped entries, and new programs be able to use the wide
fields with using the original db file.
 1.12 13-Mar-2020  roy terminfo: promote numeric parameters from short to int

POSIX mandates implementations must support upto a short but may exceed it.
When NetBSD terminfo was implemented, no terminfo description used over
a short, but because ncurses has supported ints for some time, some now do.

Infact, such a terminfo description was imported where colour pairs for
screen-256color went up to 65536 which exposed a bug in the existing
implementation where it set to zero. Because the number might mean
something more than a range, we need to be able to store it accurately.

This requires a version bump because whilst the API hasn't changed thanks
to C int promotion, the ABI has. Also the underlying database structure
has changed as well - we now store the numeric paramter inside a uint32_t
field rather than a uint16_t one.
Whilst this change can still read the old style database, the old one
cannot read the new one and thus we now maintain the database as
terminfo2.cdb, leaving the old library and database alone so old programs
still work fine.

libcurses, libfrom, libmenu and libpanel have also been bumped to
accomoate this change.
 1.11 24-Jan-2013  roy branches: 1.11.30;
Move the strings vs long analysis to a private function, but allow
tput(1) to use it so we can work with string parameters to capabilities.
 1.10 03-Jun-2012  joerg branches: 1.10.2;
Switch terminfo(3) to cdb(5).
 1.9 03-Oct-2011  roy branches: 1.9.2; 1.9.4;
Remove _ti_freeterm as consumers should just use del_curterm.
 1.8 22-Sep-2010  roy Our API just uses typedefs, so don't use the struct symbol which will avoid
any potential conflicts with userland.
 1.7 02-Mar-2010  roy Use _ti_get_token instead of strsep when parsing termcap entries.
This allows us to handle \E\ as a valid sequence.
 1.6 22-Feb-2010  roy libterminfo can now compile a single terminfo description which allows
$TERMINFO to be a terminfo description as well as a file reference.

This enables the user to modify the terminfo description on read-only
media.
 1.5 11-Feb-2010  roy Embed ansi, dumb, vt100, vt220 and wsvt25 compiled terminal descriptions
into libterminfo.
Constify some foo.
 1.4 05-Feb-2010  he More adaptation for ports with unsigned char as char.
 1.3 05-Feb-2010  roy Store the aliases against the entry, so that infocmp can reproduce them.
Handy for creating smaller terminfo databases.
 1.2 03-Feb-2010  snj Fix some typos and spelling errors.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.9.4.2 14-Mar-2013  riz Pull up following revision(s) (requested by roy in ticket #835):
lib/libterminfo/terminfo.3: revision 1.9
lib/libterminfo/term.h: revision 1.13
lib/libterminfo/term.h: revision 1.14
usr.bin/tput/Makefile: revision 1.11
lib/libterminfo/terminfo.3: revision 1.10
lib/libterminfo/genman: revision 1.5
lib/libterminfo/term_private.h: revision 1.11
usr.bin/tput/tput.c: revision 1.23
usr.bin/tput/tput.c: revision 1.24
usr.bin/tput/tput.c: revision 1.25
lib/libterminfo/tparm.c: revision 1.11
lib/libterminfo/Makefile.hash: revision 1.7
usr.bin/tput/tput.c: revision 1.26
lib/libterminfo/tparm.c: revision 1.12
lib/libterminfo/tparm.c: revision 1.13
lib/libterminfo/tparm.c: revision 1.14
lib/libterminfo/terminfo.5.in: revision 1.18
As tparm accepts longs we should treat them as long during expansion.
Also, fix the ~ and ! logic.
Move the strings vs long analysis to a private function, but allow
tput(1) to use it so we can work with string parameters to
capabilities.
Fix building our terminals with a non standard NETBSDSRCDIR, PR
lib/46793.
Thanks to Bernd Ernesti.
Remove debug accidently commited.
If char * > long then print a suitable error when passing a string
parameter.
For platforms where we cannot fit a char * into a long, return NULL
and set errno to ENOTSUPP.
Add descriptions for terminfo keys to term.h
These are extracted by genman and placed into the compiled terminfo.5
Fixes PR lib/47090
Provide a disabled implentation of tlparm and ti_tlparm for
completeness.
This also improves the readability of _ti_tiparm.
Use putp(3) to output our strings.
Fixes PR lib/47532
 1.9.4.1 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.9.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.2.1 30-Oct-2012  yamt sync with head
 1.10.2.1 25-Feb-2013  tls resync with head
 1.11.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.9 22-Oct-2017  abhinav Remove tputs from NAME section since it is described in terminfo(3)
 1.8 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.7 20-Jul-2013  wiz Use Mt for email addresses.
 1.6 14-Mar-2011  christos branches: 1.6.4; 1.6.10; 1.6.14;
OOPS has been reverted.
 1.5 07-Mar-2011  christos Restore historical behavior of tgoto() to return "OOPS" on failure. This is
best for now because there are too many programs that don't check the return
value of it. Of course cursor motion commands from $TERMCAP have 0 chance
of working now, since their % escapes are not translated to terminfo. In
the window case %+ expects one param from the stack in the termcap case
and two in the terminfo so we barf. We need proper captoinfo handling for
the % escapes, like the one in ncurses. Hi Roy :-)
 1.4 04-Feb-2010  wiz More markup.
 1.3 03-Feb-2010  snj Fix some typos and spelling errors.
 1.2 03-Feb-2010  wiz Use Nx.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.6.14.1 23-Jul-2013  riastradh sync with HEAD
 1.6.10.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.25 31-Jan-2023  andvar fix few typos in comments.
 1.24 05-Apr-2020  martin Conditionalize a few more functions (hopefully fixing the build)
 1.23 27-Mar-2020  christos Introduce a bunch of inline functions and utilities to avoid code duplication.
 1.22 04-May-2017  roy branches: 1.22.10;
Clean up some compile warnings.
 1.21 01-May-2017  roy Whitespace police.
 1.20 11-Jan-2017  roy branches: 1.20.4;
Fix some off by one issues with arraycount ..thanks coypu.
 1.19 01-Apr-2016  christos branches: 1.19.2;
- if we are freeing cur_term, set it to NULL.
- preserve and free "last" properly.

$ cat foo.c
#include <stdio.h>
#include <termcap.h>

int
main(void)
{
tgetent(NULL, "dumb");
tgetent(NULL, "network");
tgetflag("so");
return 0;
}
$ cc foo.c -lterminfo
$ MALLOC_OPTIONS=J ./a.out
Boom.

XXX: pullup-7
 1.18 25-Nov-2015  christos PR/50092: Rin Okuyama: Fix memory leak.
 1.17 13-Nov-2011  christos branches: 1.17.18; 1.17.22;
make use we don't touch memory past the end of the buffer. Pointed out
by tnozaki.
 1.16 03-Oct-2011  roy branches: 1.16.2;
Correctly use ti_ instead of t_ for our extensions as per the man page.
Replace vtparm with tiparm.
tiparm is also non standard, but has been proposed at least.
 1.15 16-Sep-2011  christos PR/45370: Takehiko NOZAKI: termcap emulation tget{flag,num,str} should
work with non-NUL terminated strings.
 1.14 18-Mar-2011  roy Simplify some conversion by usig pre formatted strings and a function
to print a parameter.
 1.13 11-Mar-2011  christos revert OOPS change now that most of the reasons for tgoto to return NULL
have been eliminated.
 1.12 10-Mar-2011  roy Add support for translating the following termcap commands into terminfo:
%B %D %r %2 %3 %d %+ %> %.
Fixes PR bin/44692.
 1.11 07-Mar-2011  christos Restore historical behavior of tgoto() to return "OOPS" on failure. This is
best for now because there are too many programs that don't check the return
value of it. Of course cursor motion commands from $TERMCAP have 0 chance
of working now, since their % escapes are not translated to terminfo. In
the window case %+ expects one param from the stack in the termcap case
and two in the terminfo so we barf. We need proper captoinfo handling for
the % escapes, like the one in ncurses. Hi Roy :-)
 1.10 12-Oct-2010  christos PR/43961: YAMAMOTO Takashi: uninitialized variable in termcap.c
Remove dead code.
 1.9 22-Sep-2010  roy Our API just uses typedefs, so don't use the struct symbol which will avoid
any potential conflicts with userland.
 1.8 04-Jul-2010  roy area is now used
 1.7 04-Mar-2010  roy Convert padding for unknown capabilities as well.
 1.6 04-Mar-2010  roy Convert padding and give terminfo some default assumptions about termcap.
 1.5 02-Mar-2010  roy Use _ti_get_token instead of strsep when parsing termcap entries.
This allows us to handle \E\ as a valid sequence.
 1.4 01-Mar-2010  roy Escape , when converting to terminfo.
 1.3 26-Feb-2010  roy Implement captoinfo so that we can convert $TERMCAP into $TERMINFO.
We don't currently map %> %B %D.
That means no conversion for regent100, hz1500, act4, act5, mime terms.
 1.2 04-Feb-2010  roy Fix build issues on other hosts.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.16.2.1 17-Apr-2012  yamt sync with head
 1.17.22.1 18-Jan-2017  skrll Sync with netbsd-5
 1.17.18.1 12-Dec-2016  snj Pull up following revision(s) (requested by riastradh in ticket #1307):
lib/libterminfo/curterm.c: revisions 1.11, 1.12
lib/libterminfo/term.c: revisions 1.18-1.20
lib/libterminfo/termcap.c: revisions 1.18, 1.19
lib/libterminfo/terminfo.3: revision 1.13
lib/libterminfo/tparm.c: revision 1.16
terminfo.3: fix ti_puts prototype
--
PR/50092: Fix memory leak.
--
PR/50092: Rin Okuyama: Fix memory leak.
--
We have the max length; use snprintf.
--
From PR/50092:
- handle calling _ti_readterm with an existing initialized terminal
- simplify free code
Also:
- fix an inconsistency in userdefs count computation
--
Always copy the area buffer, even when the length was the same
(from Rin Okuyama)
--
- if we are freeing cur_term, set it to NULL.
- preserve and free "last" properly.
--
off-by-one in memcpy. Found by ASAN (Carsten Kunze)
 1.19.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.20.4.2 11-May-2017  pgoyette Sync with HEAD
 1.20.4.1 02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.22.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2 11-Apr-2011  roy POSIX says that term.h should define tgetstr and friends
Fixes PR lib/43941
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.4 02-Nov-2011  roy Now that nbperf can generate the same file using the -p option,
there is no longer a need to store these files in CVS.
 1.3 12-Feb-2010  roy Don't try to map obsolete termcap bc and nl to terminfo.
 1.2 04-Feb-2010  roy Fix build issues on other hosts.
 1.1 03-Feb-2010  roy Store our generated files in CVS and remove nbperf from the toolchain.
This allows us to build consistent libs without an ever changing hash.
 1.3 22-Sep-2010  roy Our API just uses typedefs, so don't use the struct symbol which will avoid
any potential conflicts with userland.
 1.2 12-Feb-2010  roy Don't try to map obsolete termcap bc and nl to terminfo.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.14 22-Oct-2017  abhinav Add missing functions to the NAME section
 1.13 23-Nov-2015  christos fix ti_puts prototype
 1.12 18-Mar-2014  riastradh branches: 1.12.4; 1.12.8;
Merge riastradh-drm2 to HEAD.
 1.11 20-Jul-2013  wiz Use Mt for email addresses.
 1.10 25-Jan-2013  roy branches: 1.10.2;
Provide a disabled implentation of tlparm and ti_tlparm for completeness.
This also improves the readability of _ti_tiparm.
 1.9 25-Jan-2013  roy For platforms where we cannot fit a char * into a long, return NULL
and set errno to ENOTSUPP.
 1.8 04-Oct-2011  roy branches: 1.8.2; 1.8.4; 1.8.8;
Move longname(3) from curses to terminfo, pre-cursor to fix PR/43386.
 1.7 03-Oct-2011  roy Correct args
 1.6 03-Oct-2011  roy Correctly use ti_ instead of t_ for our extensions as per the man page.
Replace vtparm with tiparm.
tiparm is also non standard, but has been proposed at least.
 1.5 02-Oct-2011  roy Add termname(3) as defined by POSIX.
 1.4 04-Feb-2010  wiz More markup.
 1.3 03-Feb-2010  snj Fix some typos and spelling errors.
 1.2 03-Feb-2010  wiz Punctuation and whitespace fixes.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.8.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.8.1 25-Feb-2013  tls resync with head
 1.8.4.1 14-Mar-2013  riz Pull up following revision(s) (requested by roy in ticket #835):
lib/libterminfo/terminfo.3: revision 1.9
lib/libterminfo/term.h: revision 1.13
lib/libterminfo/term.h: revision 1.14
usr.bin/tput/Makefile: revision 1.11
lib/libterminfo/terminfo.3: revision 1.10
lib/libterminfo/genman: revision 1.5
lib/libterminfo/term_private.h: revision 1.11
usr.bin/tput/tput.c: revision 1.23
usr.bin/tput/tput.c: revision 1.24
usr.bin/tput/tput.c: revision 1.25
lib/libterminfo/tparm.c: revision 1.11
lib/libterminfo/Makefile.hash: revision 1.7
usr.bin/tput/tput.c: revision 1.26
lib/libterminfo/tparm.c: revision 1.12
lib/libterminfo/tparm.c: revision 1.13
lib/libterminfo/tparm.c: revision 1.14
lib/libterminfo/terminfo.5.in: revision 1.18
As tparm accepts longs we should treat them as long during expansion.
Also, fix the ~ and ! logic.
Move the strings vs long analysis to a private function, but allow
tput(1) to use it so we can work with string parameters to
capabilities.
Fix building our terminals with a non standard NETBSDSRCDIR, PR
lib/46793.
Thanks to Bernd Ernesti.
Remove debug accidently commited.
If char * > long then print a suitable error when passing a string
parameter.
For platforms where we cannot fit a char * into a long, return NULL
and set errno to ENOTSUPP.
Add descriptions for terminfo keys to term.h
These are extracted by genman and placed into the compiled terminfo.5
Fixes PR lib/47090
Provide a disabled implentation of tlparm and ti_tlparm for
completeness.
This also improves the readability of _ti_tiparm.
Use putp(3) to output our strings.
Fixes PR lib/47532
 1.8.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.2.1 23-Jul-2013  riastradh sync with HEAD
 1.12.8.1 18-Jan-2017  skrll Sync with netbsd-5
 1.12.4.1 12-Dec-2016  snj Pull up following revision(s) (requested by riastradh in ticket #1307):
lib/libterminfo/curterm.c: revisions 1.11, 1.12
lib/libterminfo/term.c: revisions 1.18-1.20
lib/libterminfo/termcap.c: revisions 1.18, 1.19
lib/libterminfo/terminfo.3: revision 1.13
lib/libterminfo/tparm.c: revision 1.16
terminfo.3: fix ti_puts prototype
--
PR/50092: Fix memory leak.
--
PR/50092: Rin Okuyama: Fix memory leak.
--
We have the max length; use snprintf.
--
From PR/50092:
- handle calling _ti_readterm with an existing initialized terminal
- simplify free code
Also:
- fix an inconsistency in userdefs count computation
--
Always copy the area buffer, even when the length was the same
(from Rin Okuyama)
--
- if we are freeing cur_term, set it to NULL.
- preserve and free "last" properly.
--
off-by-one in memcpy. Found by ASAN (Carsten Kunze)
 1.6 09-Feb-2010  roy We should always generate terminfo.5 to save human error syncing.
 1.5 05-Feb-2010  roy Don't look in /etc for a terminfo database.
Don't report the rescue database if we did not find the terminal in
there AND we were able to access prior databases.
 1.4 05-Feb-2010  roy Allow loading of a terminfo database in /rescue.
 1.3 04-Feb-2010  roy Sync terminfo.5 changes into terminfo.5.in
 1.2 03-Feb-2010  snj Regenerate to pick up the changes from terminfo.5.in revision 1.3.
 1.1 03-Feb-2010  roy Store our generated files in CVS and remove nbperf from the toolchain.
This allows us to build consistent libs without an ever changing hash.
 1.25 18-Oct-2025  wiz Add compatibility and environment variable sections.

With help from RVP.

Bump date.
 1.24 05-Jun-2020  roy terminfo(5): Numbre -> Number

Thanks to yukonbob
 1.23 10-Oct-2018  uwe Fix pasto.
 1.22 29-Jan-2017  abhinav branches: 1.22.10; 1.22.12;
Fix a typo.
 1.21 12-Jan-2017  roy branches: 1.21.2;
Correct terminfo variable pkey_norm to plab_norm.
 1.20 18-Mar-2014  riastradh branches: 1.20.8;
Merge riastradh-drm2 to HEAD.
 1.19 20-Jul-2013  wiz Use Mt for email addresses.
 1.18 25-Jan-2013  roy branches: 1.18.2;
Add descriptions for terminfo keys to term.h
These are extracted by genman and placed into the compiled terminfo.5
Fixes PR lib/47090
 1.17 05-Jun-2012  wiz branches: 1.17.2;
Bump date for previous.
 1.16 03-Jun-2012  joerg Switch terminfo(3) to cdb(5).
 1.15 10-Mar-2011  roy branches: 1.15.4; 1.15.6;
Add support for translating the following termcap commands into terminfo:
%B %D %r %2 %3 %d %+ %> %.
Fixes PR bin/44692.
 1.14 26-Feb-2010  wiz '>' replacement for HTML output, be explicit about slash.
 1.13 26-Feb-2010  roy Implement captoinfo so that we can convert $TERMCAP into $TERMINFO.
We don't currently map %> %B %D.
That means no conversion for regent100, hz1500, act4, act5, mime terms.
 1.12 22-Feb-2010  roy libterminfo can now compile a single terminfo description which allows
$TERMINFO to be a terminfo description as well as a file reference.

This enables the user to modify the terminfo description on read-only
media.
 1.11 12-Feb-2010  roy Don't try to map obsolete termcap bc and nl to terminfo.
 1.10 11-Feb-2010  wiz Oxford serial comma.
 1.9 11-Feb-2010  roy Respect TERMINFO_DIRS and document using an embedded database.
 1.8 11-Feb-2010  roy Correct date
 1.7 06-Feb-2010  wiz Sync with terminfo(5): Remove /etc/terminfo.db.
 1.6 05-Feb-2010  roy Allow loading of a terminfo database in /rescue.
 1.5 04-Feb-2010  roy Sync terminfo.5 changes into terminfo.5.in
 1.4 04-Feb-2010  wiz More markup.
 1.3 03-Feb-2010  snj Fix some typos and spelling errors.
 1.2 03-Feb-2010  wiz Sort SEE ALSO.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.15.6.2 14-Mar-2013  riz Pull up following revision(s) (requested by roy in ticket #835):
lib/libterminfo/terminfo.3: revision 1.9
lib/libterminfo/term.h: revision 1.13
lib/libterminfo/term.h: revision 1.14
usr.bin/tput/Makefile: revision 1.11
lib/libterminfo/terminfo.3: revision 1.10
lib/libterminfo/genman: revision 1.5
lib/libterminfo/term_private.h: revision 1.11
usr.bin/tput/tput.c: revision 1.23
usr.bin/tput/tput.c: revision 1.24
usr.bin/tput/tput.c: revision 1.25
lib/libterminfo/tparm.c: revision 1.11
lib/libterminfo/Makefile.hash: revision 1.7
usr.bin/tput/tput.c: revision 1.26
lib/libterminfo/tparm.c: revision 1.12
lib/libterminfo/tparm.c: revision 1.13
lib/libterminfo/tparm.c: revision 1.14
lib/libterminfo/terminfo.5.in: revision 1.18
As tparm accepts longs we should treat them as long during expansion.
Also, fix the ~ and ! logic.
Move the strings vs long analysis to a private function, but allow
tput(1) to use it so we can work with string parameters to
capabilities.
Fix building our terminals with a non standard NETBSDSRCDIR, PR
lib/46793.
Thanks to Bernd Ernesti.
Remove debug accidently commited.
If char * > long then print a suitable error when passing a string
parameter.
For platforms where we cannot fit a char * into a long, return NULL
and set errno to ENOTSUPP.
Add descriptions for terminfo keys to term.h
These are extracted by genman and placed into the compiled terminfo.5
Fixes PR lib/47090
Provide a disabled implentation of tlparm and ti_tlparm for
completeness.
This also improves the readability of _ti_tiparm.
Use putp(3) to output our strings.
Fixes PR lib/47532
 1.15.6.1 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.15.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.4.1 30-Oct-2012  yamt sync with head
 1.17.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.2.1 25-Feb-2013  tls resync with head
 1.18.2.1 23-Jul-2013  riastradh sync with HEAD
 1.20.8.1 20-Mar-2017  pgoyette Sync with HEAD
 1.21.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.22.12.1 10-Jun-2019  christos Sync with HEAD
 1.22.10.1 20-Oct-2018  pgoyette Sync with head
 1.1 21-Nov-2024  riastradh branches: 1.1.4;
libterminfo: Add expected symbols list.

PR lib/58838: shared libraries in base should all have expsym lists
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 21-Nov-2024  perseant file terminfo.expsym was added on branch perseant-exfatfs on 2025-08-02 05:54:59 +0000
 1.3 07-Jun-2013  roy Whitespace
 1.2 04-Feb-2010  roy branches: 1.2.6; 1.2.12;
Fix build issues on other hosts.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.2.12.1 23-Jun-2013  tls resync from head
 1.2.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.19 27-Aug-2021  rillig libterminfo: remove redundant lint annotations

Since 2021-02-28, lint does not warn about constant conditions if they
involve sizeof.

The fallthrough annotations have never been necessary for case labels
that directly follow each other.
 1.18 27-Mar-2020  christos As described in tech-userlevel:
- Modify the writing code to only write entries in the new
format for the terminal descriptions that require it.
- Store new format entries as <name>@v3
- Store old format entries with clamped values as <name> for
backwards compatibility
- Lookup first <name>@v3 and then <name> if that is not found.
- Don't create terminfo2 anymore; old programs keep working with
clamped entries, and new programs be able to use the wide
fields with using the original db file.
 1.17 04-May-2017  roy branches: 1.17.10;
Clean up some compile warnings.
 1.16 25-Nov-2015  christos branches: 1.16.6;
We have the max length; use snprintf.
 1.15 07-Jun-2013  roy branches: 1.15.6; 1.15.10;
Whitespace
 1.14 25-Jan-2013  roy Provide a disabled implentation of tlparm and ti_tlparm for completeness.
This also improves the readability of _ti_tiparm.
 1.13 25-Jan-2013  roy For platforms where we cannot fit a char * into a long, return NULL
and set errno to ENOTSUPP.
 1.12 24-Jan-2013  roy Move the strings vs long analysis to a private function, but allow
tput(1) to use it so we can work with string parameters to capabilities.
 1.11 24-Jan-2013  roy As tparm accepts longs we should treat them as long during expansion.
Also, fix the ~ and ! logic.
 1.10 23-Jan-2013  roy Fix %t logic and don't output any %; or %e parts.
Fixes PR lib/47490 thanks to Julien Oster
 1.9 30-Nov-2012  msaitoh Fix off by one error.
 1.8 02-Jun-2012  roy branches: 1.8.2;
Ensure that we request a buffer big enough, although with the current
terminfo specification this should never happen.
Correctly return NULL when realloc(3) fails.
 1.7 03-Oct-2011  roy branches: 1.7.2; 1.7.4; 1.7.8;
Fix tparm.
As we now go via tiparm, store nums as int to conserve memory.
 1.6 03-Oct-2011  roy Correctly use ti_ instead of t_ for our extensions as per the man page.
Replace vtparm with tiparm.
tiparm is also non standard, but has been proposed at least.
 1.5 10-Mar-2011  roy Do our best to process invalid terminfo strings instead of just
returning NULL.
 1.4 10-Mar-2011  roy Fix two other off-by-one errors when processing %P and %g commands.
 1.3 10-Mar-2011  roy Fix an off-by-one error when processing embedded values.
 1.2 22-Sep-2010  roy Our API just uses typedefs, so don't use the struct symbol which will avoid
any potential conflicts with userland.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.7.8.1 11-Dec-2012  riz Pull up following revision(s) (requested by msaitoh in ticket #734):
lib/libterminfo/tparm.c: revision 1.9
Fix off by one error.
 1.7.4.4 14-Mar-2013  riz Pull up following revision(s) (requested by roy in ticket #835):
lib/libterminfo/tparm.c: revision 1.8
Ensure that we request a buffer big enough, although with the current
terminfo specification this should never happen.
Correctly return NULL when realloc(3) fails.
 1.7.4.3 14-Mar-2013  riz Pull up following revision(s) (requested by roy in ticket #835):
lib/libterminfo/terminfo.3: revision 1.9
lib/libterminfo/term.h: revision 1.13
lib/libterminfo/term.h: revision 1.14
usr.bin/tput/Makefile: revision 1.11
lib/libterminfo/terminfo.3: revision 1.10
lib/libterminfo/genman: revision 1.5
lib/libterminfo/term_private.h: revision 1.11
usr.bin/tput/tput.c: revision 1.23
usr.bin/tput/tput.c: revision 1.24
usr.bin/tput/tput.c: revision 1.25
lib/libterminfo/tparm.c: revision 1.11
lib/libterminfo/Makefile.hash: revision 1.7
usr.bin/tput/tput.c: revision 1.26
lib/libterminfo/tparm.c: revision 1.12
lib/libterminfo/tparm.c: revision 1.13
lib/libterminfo/tparm.c: revision 1.14
lib/libterminfo/terminfo.5.in: revision 1.18
As tparm accepts longs we should treat them as long during expansion.
Also, fix the ~ and ! logic.
Move the strings vs long analysis to a private function, but allow
tput(1) to use it so we can work with string parameters to
capabilities.
Fix building our terminals with a non standard NETBSDSRCDIR, PR
lib/46793.
Thanks to Bernd Ernesti.
Remove debug accidently commited.
If char * > long then print a suitable error when passing a string
parameter.
For platforms where we cannot fit a char * into a long, return NULL
and set errno to ENOTSUPP.
Add descriptions for terminfo keys to term.h
These are extracted by genman and placed into the compiled terminfo.5
Fixes PR lib/47090
Provide a disabled implentation of tlparm and ti_tlparm for
completeness.
This also improves the readability of _ti_tiparm.
Use putp(3) to output our strings.
Fixes PR lib/47532
 1.7.4.2 14-Mar-2013  riz Pull up following revision(s) (requested by roy in ticket #834):
lib/libterminfo/tparm.c: revision 1.10
Fix %t logic and don't output any %; or %e parts.
Fixes PR lib/47490 thanks to Julien Oster
 1.7.4.1 11-Dec-2012  riz Pull up following revision(s) (requested by msaitoh in ticket #734):
lib/libterminfo/tparm.c: revision 1.9
Fix off by one error.
 1.7.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.2.2 16-Jan-2013  yamt sync with (a bit old) head
 1.7.2.1 30-Oct-2012  yamt sync with head
 1.8.2.2 23-Jun-2013  tls resync from head
 1.8.2.1 25-Feb-2013  tls resync with head
 1.15.10.1 18-Jan-2017  skrll Sync with netbsd-5
 1.15.6.1 12-Dec-2016  snj Pull up following revision(s) (requested by riastradh in ticket #1307):
lib/libterminfo/curterm.c: revisions 1.11, 1.12
lib/libterminfo/term.c: revisions 1.18-1.20
lib/libterminfo/termcap.c: revisions 1.18, 1.19
lib/libterminfo/terminfo.3: revision 1.13
lib/libterminfo/tparm.c: revision 1.16
terminfo.3: fix ti_puts prototype
--
PR/50092: Fix memory leak.
--
PR/50092: Rin Okuyama: Fix memory leak.
--
We have the max length; use snprintf.
--
From PR/50092:
- handle calling _ti_readterm with an existing initialized terminal
- simplify free code
Also:
- fix an inconsistency in userdefs count computation
--
Always copy the area buffer, even when the length was the same
(from Rin Okuyama)
--
- if we are freeing cur_term, set it to NULL.
- preserve and free "last" properly.
--
off-by-one in memcpy. Found by ASAN (Carsten Kunze)
 1.16.6.1 11-May-2017  pgoyette Sync with HEAD
 1.17.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.6 15-Dec-2021  blymn Fix for PR lib/56298

Remove the DIAGASSERT for str being NULL in the puts/putp functions,
add protection so that the functions just return OK if str is NULL.
This prevents the assert firing when libcurses passes through a NULL
due to an undefined terminfo entry.
 1.5 03-Oct-2019  christos Cast function pointers that take different arguments through void *
 1.4 01-May-2017  roy branches: 1.4.10;
Fix some compile warnings.
 1.3 07-Jun-2013  roy branches: 1.3.18;
Whitespace
 1.2 12-Feb-2010  martin branches: 1.2.6; 1.2.12;
Fix an array bounds check - fixes PR lib/42793.
Restore a comment (from libterm/tputs.c), requested by jdc.
 1.1 03-Feb-2010  roy Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
 1.2.12.1 23-Jun-2013  tls resync from head
 1.2.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.18.1 02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.4.10.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411

RSS XML Feed