DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 11th December 2008
JimC JimC is offline
New User
 
Join Date: Aug 2008
Posts: 9
Thanked 0 Times in 0 Posts
Default ncurses & function keys

I am moving some applications from FreeBSD to OpenBSD which use ncurses. I can't get the function keys to work in OpenBSD. TERM= vt220. Pressing a function key returns an escape sequence instead of the value defined in ncurses.h. Does anyone have a suggestion.

Thanks.
Reply With Quote
  #2   (View Single Post)  
Old 24th October 2011
comet--berkeley comet--berkeley is offline
Shell Scout
 
Join Date: Apr 2009
Posts: 92
Thanked 1 Time in 1 Post
Default ncurses and function keys - new terminal type based on vt220

I had trouble with the midnight commander (mc) program using the vt220 terminal emulation and decided to create my own new TERM types.

I called them "openbsd" and for monochrome, '"openbsd-m".

Below is a script I wrote to create a .terminfo directory and termcap file in my local user home directory.

To use the script, run it and then put this in the .profile

export TERM=openbsd

I call the script maketerminfo.sh

Code:
#! /bin/sh
set -e
INFODIR=$HOME/.terminfo
CAPFILE=$HOME/.termcap
/bin/cat << THERE

 Create new terminfo/termcap entries called
   openbsd and openbsd-m
 by making a new terminfo file and terminfo entries in
 my $INFODIR directory
 and by creating my own termcap file as $CAPFILE
-----------------------------------------------------
 To use the new terminfo/termcap entries,
 put something like this in your .profile

    export TERM=openbsd

 Or if you prefer monochrome:

    export TERM=openbsd-m

THERE
/bin/mkdir -p $INFODIR
cd $INFODIR
/bin/cat /dev/null      > terminfo
/bin/cat << HERE       >> terminfo
# This is a newer version of vt220 for OpenBSD that
# fixes the Function keys and the Home and End keys.
openbsd-m|OpenBSD mono from vt220,
        am, mir, xenl, xon,
        cols#80, lines#24, vt#3,
        acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
        bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, civis=\E[?25l,
        clear=\E[H\E[2J$<50>, cnorm=\E[?25h, cr=^M,
        csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C,
        cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P,
        dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I,
        if=/usr/share/tabset/vt100, il1=\E[L, ind=\ED$<20/>,
        is2=\E[1;24r\E[24;1H, kbs=\177, kcub1=\E[D, kcud1=\E[B,
        kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[8~,
        kf1=\E[11~, kf10=\E[21~, kf11=\E22~, kf12=\E23~,
        kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~,
        kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[7~,
        kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rc=\E8, rev=\E[7m$<2>,
        rf=/usr/share/tabset/vt100, ri=\EM$<14/>,
        rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m,
        rmul=\E[24m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h,
        sc=\E7,
        sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;,
        sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h,
        smso=\E[7m, smul=\E[4m,

# A copy of wsvt25 for OpenBSD in color with
# Function keys and Home/End keys fixed
openbsd|OpenBSD color 25 line vt220 mode,
        am, bce, mir, msgr, xenl, xon,
        colors#8, cols#80, lines#25, ncv#3, pairs#64, vt#3,
        acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
        bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, civis=\E[?25l,
        clear=\E[H\E[2J$<50>, cnorm=\E[?25h, cr=^M,
        csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C,
        cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P,
        dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I,
        if=/usr/share/tabset/vt100, il1=\E[L, ind=\ED$<20/>,
        is2=\E[1;24r\E[24;1H, kbs=\177, kcub1=\E[D, kcud1=\E[B,
        kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[8~,
        kf1=\E[11~, kf10=\E[21~, kf11=\E22~, kf12=\E23~,
        kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~,
        kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[7~,
        kich1=\E[2~, knp=\E[6~, kpp=\E[5~, op=\E[m, rc=\E8,
        rev=\E[7m$<2>, rf=/usr/share/tabset/vt100,
        ri=\EM$<14/>, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l,
        rmso=\E[27m, rmul=\E[24m,
        rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
        setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
        sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;,
        sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h,
        smso=\E[7m, smul=\E[4m,
HERE
/usr/bin/tic -o$INFODIR -s terminfo
/usr/bin/infotocap         terminfo > $CAPFILE
/bin/ls -aldF $HOME/.term*
exit
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
arrow keys in X idefix FreeBSD General 8 25th September 2009 08:16 AM
Undefined function in OpenBSD WeakSauceIII OpenBSD General 4 20th May 2009 12:58 PM
change compiz-fusion shortcut keys cuongvt FreeBSD General 2 21st September 2008 11:29 AM
How to vectorize a function for numpy arrays in Python kasse Programming 0 26th August 2008 12:12 PM


All times are GMT. The time now is 12:12 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick