Sunday, 28 September 2014

Reading a terminfo file

The terminfo/termcap configure various terminals in linux

The infocmp can be used to dump the compiled current terminal configurations into the terminfo format.

Sample output of infocmp

#       Reconstructed via infocmp from file: /usr/share/terminfo/c/cygwin
cygwin|ansi emulation for Cygwin,
        am, hs, mir, msgr, xon,
        colors#8, it#8, pairs#64,
        bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, cub=\E[%p1%dD,

Here's how to read the output

# - comment
the first line of | separated fields are the aliases of the terminal (ends with comma)
3 kinds of settings - all comma separated.
simple words  - boolean variables (eg. am = auto margin)
word#number - sets variable to numbers - eg. colors#8
word=string - sets variable to string

Reference:
http://docstore.mik.ua/orelly/unix/upt/ch41_11.htm

No comments:

Post a Comment