Subject: Re: A solution for termcap lossage?
To: Brett Lymn <blymn@baea.com.au>
From: Simon Burge <simonb@netbsd.org>
List: tech-userlevel
Date: 04/24/1999 23:37:27
I meant to have replied to this earlier...  I was the one doing ncurses
integration, before I was aware of the work you and Julian were doing.

The main reason for looking at ncurses was that it is currently actively
maintained, and that it had changed maintainers and was still going
forward.  BSD curses didn't appear to be at that stage.  It also was at
the stage (or close too) of standards compiliance.

A major stumbling block for ncurses was that it's internal terminfo
representation didn't allow for extension to terminal attributes.  For
example, you couldn't add a "zz" capability, even when in "termcap
compatibility mode".  The current maintainer has stated that this will
be a goal _after_ the next release of ncurses.

The argument of "terminfo databases taking up loads of inodes" is an
implementation issue. ncurses is happy to run with just a termcap file
(or termcap.db - it can use getcap() and friends).

I like Christos' idea of a new threaded-friendly API, but I think we
need the old API to handle >1kB termcap entries without the need to
change third-party source.  Something that comes to mind is to store a
pointer to a larger buffer (if needed) in the last sizeof(ptr) bytes
(maybe preceded by a magic number of some sort) at the very end of
the user-supplied 1kB buffer.  User supplied code scan still manually
look at the first 1kb-sizeof(ptr)-sizeof(magic)-NUL characters of the
buffer - I'm sure I've seen some game source do this instead of using
tgetstr(), tgetnum(), etc.  I guess that this has the drawback of memory
management - at the moment the user doesn't have to tell the library
when it's finished with the termcap buffer...  If you like this idea I
can work on it more (more than the few minutes I just put into it!).

If we are going to junk of the idea of ncurses altogether, maybe it
would also be worth adding a terminfo API as well.  This may be of
limited value (most code probably starts out as termcap based), but
you never know.

It doesn't worry me either way if we move to ncurses or update BSD
curses.  As long as we're moving forward, I'm happy (and happy to help
either way)...

Simon.