home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 3
/
Meeting_Pearls_III.iso
/
Pearls
/
tcp
/
Networking
/
TCP
/
Clients
/
finger
/
amiga.c
next >
Wrap
C/C++ Source or Header
|
1993-08-10
|
598b
|
41 lines
/*
* This is only for the GNU C Compiler.
*/
#include <bsdsocket.h>
#include <sys/types.h>
#include <signal.h>
#include <exec/libraries.h>
#include <dos/dosextens.h>
#include <dos/dos.h>
#include <sys/time.h>
int sgetc(int sock)
{
unsigned char c;
fd_set rd,ex;
long flgs;
int n;
struct timeval t;
t.tv_sec = 10L;
t.tv_usec = 0;
FD_ZERO(&rd);
FD_ZERO(&ex);
FD_SET(sock,&rd);
FD_SET(sock,&ex);
flgs = SIGBREAKF_CTRL_D;
WaitSelect(16,&rd,0L,&ex,&t,&flgs);
if (FD_ISSET(sock,&rd))
{ n = recv(sock, &c, 1, 0);
if (n == 1)
return c;
else return -1;
}
else return -1;
}