[1808889 views]

[]

Odi's astoundingly incomplete notes

New entries | Code

Cygwin terminal to Solaris / SunOS

Connecting to a Solaris machine, my Cgywin terminal seems unsupported:
top: no termcap entry for a `cygwin' terminal
Note: Solaris' termcap uses terminfo really. No termcap file is ever really read! I worked around it by tar'ing the terminfo db from Cygwin and uploading it to the home directory of that user. First tar and upload Cygwin's terminfo db:
cd /usr/share/terminfo
tar czf terminfo.tgz *
scp terminfo.tgz user@solaris:
rm terminfo.tgz
Then on the remote machine unpack it to the ~/.terminfo directory:
gunzip terminfo.tgz
mkdir .terminfo
cd .terminfo
tar xf ../terminfo.tar
# fix a symlink
rm terminfo
ln -s /usr/share/lib/terminfo
cd ..
rm terminfo.tar
export TERMINFO=${HOME}/.terminfo
Now edit .bash_profile to set the TERMINFO variable on login:
# teach Solaris what my terminal is
export TERMINFO=${HOME}/.terminfo
Now the only thing missing, is a useable vi configuration. On Solaris this is the really old Unix vi, and not vim. So its config file is ~/.exrc. Here we need key mappings for Home, End, PageUp, PageDown, Delete and maybe even the cursor keys. For every key put a mapping in the file like:
map <Escape sequence> <command>

You can enter the escape sequence by pressing Ctrl-V and then the desired key (like PageDown). If the command is also an escape sequence (like Ctrl-F), then also just press Ctrl-V before hitting it. So you should get something like that:
set showmode
" Home
map ^[[1~ 0
" End
map ^[[4~ $
" PgUp
map ^[[5~ ^B
" PgDown
map ^[[6~ ^F
" Del
map ^[[3~ x
" Down
map ^[[B j
" Up
map ^[[A k
" Left
map ^[[D h
" Right
map ^[[C l


posted on 2007-12-18 13:17 UTC in Code | 3 comments | permalink
A much easier fix would just be to set the term to something solaris supports - usually I get away with something like:

TERM=xterm; export TERM

/Mads
While that may work quite well, it's a bad thing (TM) to do. You should not lie to terminfo about your terminal. Otherwise there is no way to fix misbehaviour. With the above approach, if something doesn't work, just fix the terminfo for Cygwin and done. If something doesn't work with xterm, you can't do anything about it or you will break real xterms.
The solution that copies the terminfo worked fine. I didn't try the VIM changes since I use vi plain.

The xterm solution did not work, nor does vt100 or vt52.

Ed