19 |
#endif |
#endif |
20 |
|
|
21 |
|
|
22 |
DEFUN("CHECK-FD-FOR-INPUT",object,fScheck_fd_for_input, |
DEFUN_NEW("CHECK-FD-FOR-INPUT",object,fScheck_fd_for_input, |
23 |
SI,2,2,NONE,OI,IO,OO,OO, |
SI,2,2,NONE,OI,IO,OO,OO,(int fd,int timeout), |
24 |
|
|
25 |
"Check FD a file descriptor for data to read, waiting TIMEOUT clicks \ |
"Check FD a file descriptor for data to read, waiting TIMEOUT clicks \ |
26 |
for data to become available. Here there are \ |
for data to become available. Here there are \ |
27 |
INTERNAL-TIME-UNITS-PER-SECOND in one second. Return is 1 if data \ |
INTERNAL-TIME-UNITS-PER-SECOND in one second. Return is 1 if data \ |
28 |
available on FD, 0 if timeout reached and -1 if failed.") |
available on FD, 0 if timeout reached and -1 if failed.") |
|
|
|
|
(fd,timeout) |
|
|
int fd; |
|
|
int timeout; |
|
29 |
{ |
{ |
30 |
fd_set inp; |
fd_set inp; |
31 |
int n; |
int n; |
75 |
} |
} |
76 |
|
|
77 |
/* P is supposed to start with a hdr and run N bytes. */ |
/* P is supposed to start with a hdr and run N bytes. */ |
78 |
void |
static void |
79 |
scan_headers(sfd) |
scan_headers(sfd) |
80 |
struct connection_state *sfd; |
struct connection_state *sfd; |
81 |
{ struct our_header *hdr; |
{ struct our_header *hdr; |
114 |
|
|
115 |
*/ |
*/ |
116 |
|
|
117 |
int |
static int |
118 |
read1(sfd,p,m,timeout) |
read1(sfd,p,m,timeout) |
119 |
struct connection_state* sfd; |
struct connection_state* sfd; |
120 |
char *p; |
char *p; |
204 |
/* send BYTES chars from buffer P to CONNECTION. |
/* send BYTES chars from buffer P to CONNECTION. |
205 |
They are packaged up with a hdr */ |
They are packaged up with a hdr */ |
206 |
|
|
207 |
|
static void |
208 |
|
write_timeout_error(char *); |
209 |
|
|
210 |
|
static void |
211 |
|
connection_failure(char *); |
212 |
|
|
213 |
int |
int |
214 |
write1(sfd,p,bytes) |
write1(sfd,p,bytes) |
215 |
struct connection_state *sfd; |
struct connection_state *sfd; |
257 |
|
|
258 |
} |
} |
259 |
|
|
260 |
DEFUN("CLEAR-CONNECTION",object,fSclear_connection,SI,1,1,NONE,OI,OO,OO,OO, |
DEFUN_NEW("CLEAR-CONNECTION",object,fSclear_connection,SI,1,1,NONE,OI,OO,OO,OO,(int fd), |
261 |
"Read on FD until nothing left to read. Return number of bytes read") |
"Read on FD until nothing left to read. Return number of bytes read") |
|
(fd) |
|
|
int fd; |
|
262 |
{char buffer[0x1000]; |
{char buffer[0x1000]; |
263 |
int n=0; |
int n=0; |
264 |
while (fix(fScheck_fd_for_input(fd,0))) |
while (fix(fScheck_fd_for_input(fd,0))) |