termcap に putty のエントリを追加する方法

環境変数 TERM に putty を指定していると、cygwin で less が警告を出します。操作も変になります。

$ less
WARNING: terminal is not fully functional
Missing filename ("less --help" for help)

これは termcap に putty のエントリがないのが原因。less を自力でコンパイルすれば直るという説もあるけれど、terminfo の putty エントリから termcap の putty エントリを作るのが簡単。

$ infocmp putty > putty.terminfo
$ tic -C putty.terminfo >> /etc/termcap

このコマンドすぐ忘れるのでメモ。
ただし tic による変換は情報が落ちるらしいので問題はあるかも。

$ tic -C putty.terminfo | head
#       Reconstructed via infocmp from file: /usr/share/terminfo/p/putty
# (untranslatable capabilities removed to fit entry within 1023 bytes)
# (sgr removed to fit entry within 1023 bytes)
# (acsc removed to fit entry within 1023 bytes)
# (terminfo-only capabilities suppressed to fit entry within 1023 bytes)
putty|PuTTY terminal emulator:\
        :am:bw:hs:mi:ms:xn:xo:\
        :it#8:\
        :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:K2=\E[G:\
        :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ae=^O:\