Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Converting termcap entries to terminfo entries



Hi Brian

On 22/10/2019 23:14, Brian Buhrow wrote:
	hello.  I'm in the process of building NetBSD-9.0 systems in an effort
to consider upgrading from my fleet of NetBSD-5.2 systems to NetBSD-9.  As
a long time window(1) user, I have a termcap entry for the window terminal
type that I use on systems that I ssh into from window(1) panes.  It is my
practice to put a termcap and a terminfo database in my home directory on
such systems, so that regardless of whether a program at the far end wants
termcap or terminfo, it will be able to draw on the screen in full screen
mode.  what I need is a way of converting the termcap entries I have into a
terminfo source file that tic(1) can compile into a .cdb file which can be
used on NetBSD-9 systems.  I have  an older version of captoinfo(1) from
the ncurses pkg, but it produces binary terminfo output unsuitable for the
tic(1) program.  I'm fuly aware that window(1) has been deprecated in favor
of tmux(1), but I haven't climbed the learning curve of tmux(1) yet and I'm
not sure it does everything I get from the window(1) program.
	So, can someone tell me what program I should use to convert termcap
files into terminfo source files suitable for the new terminfo libraries in
NetBSD-8 and 9?

We don't have any specific program as such, but terminfo(5) has a section "Fetching Compiled Descriptions"

If the environment variable TERMCAP is available and does not begin with
a slash (`/') then it will be translated into terminfo and compiled as
above.  If its name matches TERM then it is used.

So you can use infocmp(8) like so:

$ TERM=captest TERMCAP="captest|:al=3*\E^R:am:bl=^G:cd=16*\E^C:ce=16\E^U:cl=2*^L:cm=\Ea%+ %+ :" infocmp
# Reconstructed from $TERMCAP
captest,
        am,
        bel=^G, clear=\f$<2*/>, cr=^M, cud1=^J,
        cup=\Ea%p1%{32}%+%c%p2%{32}%+%c, ed=\E\003$<16*/>, el=\E\025$<16/>,
        ht=^I, il1=\E\022$<3*/>, ind=^J, kbs=^H, kcub1=^H, kcud1=^J,
        nel=^M^J,

I don't know how accurate the conversion will be for you as it's not entirely a 1-1 mapping and I think some assumptions are made (I've not looked at the source for a while), but hopefully it's good enough.

Might be time consusing with many termcap entries to convert, but it should be scriptable at least. Is this good enough for you?

Roy


Home | Main Index | Thread Index | Old Index