[comp.sys.sgi] Cannot find the include file I need

taylorr@glycine.cs.unc.edu (Russell Taylor) (06/13/90)

	We have an IRIS 4D running OS 3.2.2.  I am trying to find the
include file that defines 'struct sgttyb'.  I know it must be there
somewhere, because /usr/include/curses.h makes use of the structure
in one of its definitions.  However, I have done :
  find /usr/include -name \*.h -exec grep -l sgttyb {} \;
and none of the include files that show up define this structure.

	I need the structure definition for a program that I am porting
from a Sun 4.  I mention the curses.h example above only because it gave
me hope that the thing was defined somewhere.

	I have tried looking at the bsd include files, but none of them
seem to have this either.

	Thanks,
	Russell Taylor

russell@ccu1.aukuni.ac.nz (06/13/90)

Curses does not use the structures sgtty! curses.h typedefs structure to termio
for system V!

#ifdef SYSV
# ifndef VINTR
#  include <termio.h>
# endif /* VINTR */
    typedef struct termio SGTTY;      !!!!!!!!
#else /* !SYSV */
# ifndef _SGTTYB_
#  include <sgtty.h>
# endif /* _SGTTYB_ */
    typedef struct sgttyb SGTTY;

I fell into the same misconception a while back!

doelz@urz.unibas.ch (06/13/90)

In article <14637@thorin.cs.unc.edu>, taylorr@glycine.cs.unc.edu (Russell Taylor) writes:
> 
> 	We have an IRIS 4D running OS 3.2.2.  I am trying to find the
> include file that defines 'struct sgttyb'.  I know it must be there
> somewhere, because /usr/include/curses.h makes use of the structure

No way. If you look at curses.h, it explicitly says 

#ifdef SYSV
 ... 
#else
# ifndef _SGTTYB_
#    include <sgtty.h> 
# endif
     typedef struct sgttyb SGTTY; 
      ... 
#endif

and this means that you won't need it on a IRIX (SYSV) in the view 
of an IRIY programmer. If you are porting from BSD, you will meet 
lots of incompatibilities like these. 

What sgtty does: It defines the speed, the erase and kill character, and the 
mode flags:  

struct sgttyb {
	char	sg_ispeed;		/* input speed */
	char	sg_ospeed;		/* output speed */
	char	sg_erase;		/* erase character */
	char	sg_kill;		/* kill character */
	short	sg_flags;		/* mode flags */
};

Unfortunately, gtty isn't supported as system call on IRIX. 
There is a smiling remark in /usr/include/sgtty.h pointing to 
/usr/include/bsd, and there  - rien ne va plus.  

BUT: If you are looking at what gtty  does, I suspect that this is 
a call which is doing the opposite of stty, namely reading the 
state of the terminal. This can be done easily by a 
ioctl(2) call. ioctl asks for the file descriptor (the terminal device), 
what you want to to (read terminal io parameters: TCGETA), and an 
argument which is device-specific. On IRIX, this one is in termio.h, 
and you need to refer to termio(7). Look at the end of the man page of 
termio(7). 
 

Hope this helps, 
Reinhard