#include <p2c/p2c.h>
int Selective_Select (int nooffds,
fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout)
{
return( select(nooffds, readfds, writefds, exceptfds, timeout) );
}
struct timeval *Selective_InitTime (long sec, long usec)
{
struct timeval *t=(struct timeval *)malloc(sizeof(struct timeval));
t->tv_sec = sec;
t->tv_usec = usec;
return( t );
}
struct timeval *Selective_KillTime (struct timeval *t)
{
free(t);
return( NULL );
}
fd_set *Selective_InitSet (void)
{
fd_set *s=(fd_set *)malloc(sizeof(fd_set));
return( s );
}
fd_set *Selective_KillSet (fd_set *s)
{
free(s);
return( NULL );
}
void Selective_FdZero (fd_set *s)
{
FD_ZERO(s);
}
void Selective_FdSet (int fd, fd_set *s)
{
FD_SET(fd, s);
}
void Selective_FdClr (int fd, fd_set *s)
{
FD_CLR(fd, s);
}
int Selective_FdIsSet (int fd, fd_set *s)
{
return( FD_ISSET(fd, s) );
}
int Selective_MaxFdsPlusOne (int a, int b)
{
if (a>b) {
return( a+1 );
} else {
return( b+1 );
}
}
void Selective_WriteCharRaw (int fd, char ch)
{
write(fd, &ch, 1);
}
char Selective_ReadCharRaw (int fd)
{
char ch;
read(fd, &ch, 1);
return( ch );
}
void _M2_Selective_init () {}