[GRASS5] Re: [winGRASS] more problems

Glynn Clements glynn.clements at virgin.net
Tue May 21 11:30:46 EDT 2002


Markus Neteler wrote:

> > > But I am still having some problems. I seems to be a
> > > little further down the road. 
> > > 
> > > After starting grass5 I get a welcome screen but after
> > > hitting the return key I get the following msg.
> > > 
> > > Error opening terminal cygwin
> > 
> > One of the Cygwin packages "termcap" or "terminfo" needs to be
> > installed (I'm not sure which one, but probably "terminfo").
> 
> According to
> http://grass.itc.it/grass5/binary/windows_cygnus/cygwin_grass50bininstall.html
> it is "termcap".

Right. Programs which uses curses (e.g. set_data) should work with
either, but programs which just use $(TERMLIB) will probably need
termcap. In any case, the "termcap" package should support most of the
terminals which are likely to be used in a Cygwin environment.

Looking into this reveals some issues with the build environment:

CURSES              = @CURSESLIB@ $(TERMLIB) $(COMPATLIB)

We probably shouldn't be linking against both curses and $(TERMLIB)
(the latter may be lib[n]curses, libtermcap, or libtermlib), as both
libraries typically define tgetent() etc, but have different
implementations (the GNU versions of libncurses and libtinfo both look
for a terminfo file first, then a termcap entry if no terminfo file is
found, while libtermcap normally only looks for a termcap entry).

$(TERMLIB) should normally only be used by programs which need to read
terminal descriptions but which handle the details themselves, rather
than using curses.

Also, the current search order for TERMLIB is:

	AC_CHECK_LIB(termlib, tgetent, TERMLIB=-ltermlib, [
	AC_CHECK_LIB(termcap, tgetent, TERMLIB=-ltermcap, [
	AC_CHECK_LIB(ncurses, tgetent, TERMLIB=-lncurses, [
	AC_CHECK_LIB(curses, tgetent, TERMLIB=-lcurses, [

1. Can anyone provide any details of libtermlib? I.e. what platforms
have it?

2. It's arguable that we should also allow for libtinfo. If it's
present, it's preferable to libtermcap (but, then, the same is true of
curses).

3. It's also arguable that we should skip most of the above, and just
try lib[n]curses. As things stand, you will have a hard time using
GRASS if you don't have curses.

Another "also", regarding the use of COMPATLIB:

There are three different ways to get/set TTY driver settings:

1. tc{get,set}attr(), "termios.h". This is the POSIX method, and the
most portable. It's also the *least* widely used within GRASS.

2. gtty()/stty(), "sgtty.h". This is the traditional BSD method
(modern BSDs support the POSIX functions). This is why we have
$COMPATLIB.

3. ioctl(TCGETA)/ioctl(TCSETAF), "termio.h". This is the old V7
method.

Most of the code which I have found uses either 2 or a combination of
2 and 3, depending upon HAVE_*_H settings. The only instance of 1
which I can find is src/paint/Interface/driverlib/io.c (which supports
all three methods, in the order 3,1,2).

As for the use of $COMPATLIB with curses, it's unlikely to be
necessary. BSD systems have [sg]tty() in libc (BSD systems don't have
a "bsd-compat" library). On non-BSD systems, curses will use one of
the other methods.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list