home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
TELECOM
/
stg_v4.lzh
/
ss_misc2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-11
|
812b
|
53 lines
/*
* _ss_mode2(path,code)
*
* force 8 bits, no parity on path (code=1 to set, 0 to restore)
*
* For Unix (i.e. SunOS) systems that have a brain damaged TCGET/SET
* ioctl that doesn't implement c_flag correctly.
*
*/
#define ERR (-1)
#ifdef sun
#include "sys/types.h"
#include "sys/stat.h"
#include "sgtty.h"
#define MAX_PATHS 32
struct sgttyb *tty[MAX_PATHS];
_ss_mode2(path,code)
int path,code;
{
struct sgttyb tmp;
if (!tty[path])
{
tty[path]=(struct sgttyb *)malloc(sizeof(tmp));
if (!tty[path])
return(ERR);
ioctl(path,TIOCGETP,tty[path]);
}
memcpy(&tmp,tty[path],sizeof(tmp));
if (code)
{
tmp.sg_flags|=ANYP|O_RAW;
}
ioctl(path,TIOCSETP,&tmp);
if (!code)
{
free(tty[path]);
tty[path]=0;
}
return(0);
}
#endif