[haiku-development] What to do with termcap?

  • From: Siarzhuk Zharski <zharik@xxxxxx>
  • To: <haiku-development@xxxxxxxxxxxxx>
  • Date: Wed, 30 Jan 2013 15:31:37 +0100

Dear Colleagues,

during the last week I was playing in my sandbox and going to reduce the population of Terminal bugs. Those bugs that are related to various control sequences parsing, colors rendering etc. And I have predictably landed in our current termcap database that looks definitely outdated nowadays and was hacked some times for our needs. Frankly speaking I convinced that we must adjust our Terminal emulation functionality to mimic declared terminal type as close to it's most used capabilities set as possible. That is why I have looked for termcap update first.

During seeking for more actual versions of termcap I visited "Termcap/Terminfo Resources Page" at http://www.catb.org/~esr/terminfo/ that looks like origin of our termcap database version too. This resource pretends to be a "master" of termcap/terminfo databases. The problem with termcap file provided on this page is that it is broken. Both terminfo and termcap databases available on this page are generated from so known master termtypes file. Generation of termcap database is just compiling this file using "tic -C" command. This process has one unpleasant "feature" - it comments out the capabilities that cannot be converted from terminfo to termcap format safely. I suspect just because of tic laziness.

On the good side the sanity check which performed by every ncurses-based application can catch some logical problems in terminal descriptions. Look into https://dev.haiku-os.org/ticket/1957 for results of this check. But on the bad side a lot of commented-out capabilities cannot be catch. And we have such broken termcap database - some of "un-paired" capabilities were hacked during fixing #1957 but there are still about 1100 commented out capabilities - so corresponding terminal entries cannot be called valid.

The only actual source of terminal capabilities information I have found, is the terminfo.src file provided with ncurses sources distribution. This file was derived from the termtypes.master published years ago at mentioned above "Termcap/Terminfo Resources Page". Obviously it can be converted into termcap using tic compiler, but the result is unacceptable because of many commented out capabilities. But anyway I think it is a good idea to keep our termcap database synchronized with the version provided by ncurses.

So the first opportunity to bring termcap in order is just to use manually corrected database generated from the ncurses' termtypes.master. Another one - switch to using terminfo. As far as I have shortly seen, ncurses can supersede the libtermcap functionality completely. But in this case the sweet dream about ncurses outsourcing become more remote than before - there are about dozen tools in the Haiku sources linking to libtermcap. But, AFAIR, FreeBSD is not "ashamed" about having ncurses in theirs system source tree. ;-)

Please share your opinions. Thank you for patiense!

--
Kind Regards,
   S.Zharski

Other related posts: