Subject: Re: ncurses vs. BSD curses
To: None <>
From: Julian Coleman <>
List: tech-userlevel
Date: 03/23/2004 11:01:41
> 1) It seems that it's up to the curses library to decide if a program may
> or may not use color.  For example, if you use compile Frotz to use
> ncurses on a NetBSD machine, it won't let you use color on an xterm.
> Why?  Xterm on NetBSD uses termcap, and for some funny reason ncurses
> doesn't want to play nice with termcap.

The curses library looks at the termcap or terminfo entry for the terminal
for the capabilities.  So, for colour support, our curses looks at the
colour-related capabilities (see src/lib/libcurses/color.c:has_colors()).
For example, our xterm entry has (colour related):


so our curses library returns true for colour if your $TERM is xterm.
(actually xterm is a real pain because of the many, incompatible terminals
that call themselves "xterm" - some of which won't do colour).  I thought
that ncurses used its own terminfo database for the terminal capabilities.
Maybe setting the terminal type to something like "xterm-xf86-v40" will
make Frotz use colour under ncurses.

> 2) Under ncurses, getch() will return OK (defined to 0 ) when Ctrl-@ or
> Ctrl-Space is pressed.  0 is also the ZSCII character code for

getch() is defined to return an int, which will have the value of the key
or ERR (that value being the ASCII value for characters < 128).  It returns
0 when ctrl-space is pressed, so 0 is a valid return.


  My other computer also runs NetBSD    /        Sailing at Newbiggin        /