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.
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.
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.
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.
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.
- 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.
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.
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.
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.