screen, 256 colours and termcap mixed with PuTTY and FreeBSD

I have a 256 colour xterm set up on my DragonFly box.

Works perfectly. Especially for vim.

Now, I use FreeBSD 5.x as a gateway box to ssh into and have irssi and likewise programs screened.

Now, I was surprised to learn that I had only 16 colours. Outside of screen I had a full 256 colour palette (make sure to fix your PuTTY configuration by the way), but inside I was stripped of my colour scheme.

So I set off to find what was causing this. Interestingly enough one of the first emails encountered was from Jeremy Chadwick who had the exact same problem.

Turns out that screen needs to be compiled with 256 colour support (a knob should be in your ports Makefile now).

Since FreeBSD’s and DragonFly’s termcap is bereft of any 256 colour definitions for xterm apparently, you need to add the following to $HOME/.screenrc:

termcap xterm* 'Co#256:AB=E[48;5;%dm:AF=E[38;5;%dm'
terminfo xterm* 'Co#256:AB=E[48;5;%p1%dm:AF=E[38;5;%p1%dm'

This overrides your termcap settings with the appropriate definitions.

If you now start screen from a shell that has TERM exported as xterm or xterm-color (xterm* wildcard actually) it will fork off to a screen with 256 colour support.

You might need this in $HOME/.vimrc:

if &term =~ "xterm" || &term =~ "screen"
  set t_Co=256
  if has("terminfo")
    let &t_Sf=nr2char(27).'[3%p1%dm'
    let &t_Sb=nr2char(27).'[4%p1%dm'
    let &t_Sf=nr2char(27).'[3%dm'
    let &t_Sb=nr2char(27).'[4%dm'

strmode() function declaration buglet fixed

Was converting files to proper ANSI C function declarations and a user tripped over the fact that old 4.4 BSD’s function prototype of strmode() had int as a parameter, whereas it has been mode_t for a long, long time (read 1994 at least).

This broke buildworld of course.

Also asked Dima Dorfman to fix this for FreeBSD (broken in 4.x, 5.x, and 6.x).

NetBSD is fixed (as was to be expected to be honest).

And OpenBSD made the parameter int everywhere with a XXX comment in the strmode.c file that it should be mode_t actually. Weird.

祈りの歌 (Song of Prayer) – The Hymn of the Fayth

The guys at Square are amazing with some ideas.

The Hymn of the Fayth in Final Fantasy X is as follows:

イ エ ユ イ
ノ ボ メ ノ
レ ン ミ リ
ヨ ジュ ヨ ゴ

ハ サ テ カ ナ エ
ク タ マ エ

Or in romaji:

i e yu i
no bo me no
re n mi ri
yo ju yo go

ha sa te ka na e
ku ta ma e

Now, this means nothing in Japanese, but when you read the first part top to bottom, left to right, syllable by syllable you get:

inoreyo ebonju yumemiyo inoriko

祈れよ エボンジュ 夢見よ 祈り子

Pray! Ebon Ju (Yu Yevon in the English edition) Dream! Child of Prayer (Fayth).

The second part is read by reading every other syllable for the first two words:

hatenaku sakae tamae


In the end, grant prosperity.