Commit Graph

34 Commits

Author SHA1 Message Date
martin b6924e8af2 Conditionalize a few more functions (hopefully fixing the build) 2020-04-05 14:53:39 +00:00
roy 9e387da605 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.
2020-04-05 12:31:02 +00:00
christos 1d30fdae10 Introduce a bunch of inline functions and utilities to avoid code duplication. 2020-03-27 17:39:53 +00:00
christos 3958d16a96 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.
2020-03-27 15:11:57 +00:00
roy aadfdb111b 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.
2020-03-13 15:19:24 +00:00
roy 7b8fbc2d04 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
2018-10-08 20:44:34 +00:00
roy 2e0a9a1da6 Improve the scope of some variables. 2017-05-16 12:03:41 +00:00
roy 8e374e1b75 Remove ticcmp and extend _ti_checkname so it can be used instead. 2017-05-16 11:16:37 +00:00
roy fc79bac804 Fix prior for multiple terminfo aliases. 2017-05-16 10:29:06 +00:00
roy 2b9f5c3f2c 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.
2017-05-16 10:25:40 +00:00
roy 2678fcfdf5 Don't bother allocating space for the database name, just print
directly to the static buffer storage.
2017-05-16 09:19:48 +00:00
roy 3edb4adc61 Move pathbuf into the function where it's actually used. 2017-05-16 08:52:14 +00:00
roy 04f58b4824 Clean up some compile warnings. 2017-05-04 09:42:23 +00:00
roy 5b2b9b53e2 Whitespace, fit in 80 and extra braces for readability.
No functional change.
2017-04-20 08:34:23 +00:00
christos ee97ae6abf off-by-one in memcpy. Found by ASAN (Carsten Kunze)
XXX: pullup 7.
2016-11-24 17:09:55 +00:00
christos f5cb16e708 Always copy the area buffer, even when the length was the same
(from Rin Okuyama)
2015-11-26 01:03:22 +00:00
christos f464a786c5 From PR/50092:
- handle calling _ti_readterm with an existing initialized terminal
- simplify free code
Also:
- fix an inconsistency in userdefs count computation
2015-11-25 19:13:49 +00:00
roy 1535311f47 Whitespace 2013-06-07 13:16:18 +00:00
joerg 2f2f99b48a Relax consistency to make it possible to match valid entries. 2012-06-06 13:36:58 +00:00
joerg fc67b0cd11 Switch terminfo(3) to cdb(5). 2012-06-03 23:19:09 +00:00
joerg 5fafac093e Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
2012-06-01 12:02:36 +00:00
roy 91ab69b0df Remove _ti_freeterm as consumers should just use del_curterm. 2011-10-03 19:18:55 +00:00
roy ed684e08ea Clean up some compile warnings 2011-04-11 21:37:19 +00:00
roy 007ba6f7e2 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.
2010-02-26 00:09:00 +00:00
roy fde317d2b1 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.
2010-02-22 23:05:39 +00:00
roy 420f923a19 Store the generated compiled terminfo descriptions so that we can build
a consistent library just from source.
2010-02-12 12:18:33 +00:00
roy b32b792e3b Respect TERMINFO_DIRS and document using an embedded database. 2010-02-11 14:36:09 +00:00
roy a2e27dcd47 Use structures so we know how long each description is. 2010-02-11 13:11:47 +00:00
roy 0c02e7a2e0 Allow a NULL description. 2010-02-11 09:42:03 +00:00
roy 90cead5eeb Embed ansi, dumb, vt100, vt220 and wsvt25 compiled terminal descriptions
into libterminfo.
Constify some foo.
2010-02-11 00:27:09 +00:00
roy 298c3fd52c 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.
2010-02-05 19:21:02 +00:00
roy ae351fab5b Store the aliases against the entry, so that infocmp can reproduce them.
Handy for creating smaller terminfo databases.
2010-02-05 12:31:56 +00:00
roy e0d0a8eecc Allow loading of a terminfo database in /rescue. 2010-02-05 09:42:21 +00:00
roy 4ca00e00d8 Import my terminfo implementation.
This uses the ncurses terminal definitions.

OK: core@, jdc@
2010-02-03 15:16:32 +00:00