[GRASS5] Darwin Pre1 gtty stty errors

Glynn Clements glynn.clements at virgin.net
Mon Jun 4 21:21:02 EDT 2001


Jeshua Lacock wrote:

> I successfully installed the Darwin static c library (Libc), and I still 
> get the gtty & stty errors.  Apparently, gtty and stty have been made 
> obsolete by ioctl().
> 
> I quote Cornell's web page:
> 
> "______
> These subroutines have been made obsolete by the ioctl subroutine.
> 
> The stty subroutine sets the state of the terminal associated with the 
> FileDescriptor parameter. The gtty subroutine retrieves the state of the 
> terminal associated with FileDescriptor. To set the state of a terminal, 
> the calling process must have write permission.
> 
> Use of the stty subroutine is equivalent to the ioctl (FileDescriptor, 
> TIOSETP, Buffer) subroutine, while use of the gtty subroutine is 
> equivalent to the ioctl (FileDescriptor, TIOGETP, Buffer) subroutine.
> " ---------
> 
> The complete URL is at:
> 
>   
> http://nim.cit.cornell.edu/usr/share/man/info/en_US/a_doc_lib/libs/basetrf2/
> stty.htm
> 
> 
> So should I try and replace the calls myself, or would someone be 
> willing to help?  An ideal simple test module that has this problem it 
> d.colors.

The current implementation of d.colors uses the TCGETA/TCSETAW
ioctl()s if HAVE_TERMIO_H is defined and stty()/gtty() otherwise. If
you're getting errors regarding stty() or gtty(), then it appears that
configure hasn't detected the <termio.h> header.

However, the ioctl()s themselves have been superseded by the POSIX.1
tcgetattr() and tcsetattr() functions.

A more significant "however" is that d.colors/tty.c is redundant; the
only functions which are used are Get_old_tty() and Get_new_tty(). 
These store the terminal settings before and after curses
initialisation. But the stored settings are never used, i.e. neither
Old_tty() nor New_tty() are called.

I will commit a fix which removes this code, which should eliminate
any portability considerations altogether. If you know of any other
programs which do this, let me know.

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



More information about the grass-dev mailing list