version 1.53, 2003/06/03 02:56:08 |
version 1.54, 2003/08/11 21:23:58 |
|
|
#include <err.h> |
#include <err.h> |
#include <errno.h> |
#include <errno.h> |
#include <netdb.h> |
#include <netdb.h> |
|
#include <poll.h> |
|
#include <stdarg.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
#include <utime.h> |
#include <utime.h> |
#include <stdarg.h> |
|
|
|
#include "ftp_var.h" |
#include "ftp_var.h" |
|
|
|
|
} |
} |
} |
} |
|
|
int |
|
empty(mask, sec) |
|
fd_set *mask; |
|
int sec; |
|
{ |
|
struct timeval t; |
|
|
|
t.tv_sec = (long) sec; |
|
t.tv_usec = 0; |
|
return (select(32, mask, (fd_set *) 0, (fd_set *) 0, &t)); |
|
} |
|
|
|
jmp_buf sendabort; |
jmp_buf sendabort; |
|
|
void |
void |
|
|
int prox_type, nfnd; |
int prox_type, nfnd; |
volatile int secndflag; |
volatile int secndflag; |
char * volatile cmd2; |
char * volatile cmd2; |
fd_set mask; |
struct pollfd pfd[1]; |
|
|
oldintr = NULL; |
oldintr = NULL; |
secndflag = 0; |
secndflag = 0; |
|
|
abort_remote(NULL); |
abort_remote(NULL); |
pswitch(!proxy); |
pswitch(!proxy); |
if (cpend) { |
if (cpend) { |
FD_ZERO(&mask); |
pfd[0].fd = fileno(cin); |
FD_SET(fileno(cin), &mask); |
pfd[0].events = POLLIN; |
if ((nfnd = empty(&mask, 10)) <= 0) { |
if ((nfnd = poll(pfd, 1, 10 * 1000)) <= 0) { |
if (nfnd < 0) { |
if (nfnd < 0) |
warn("abort"); |
warn("abort"); |
} |
|
if (ptabflg) |
if (ptabflg) |
code = -1; |
code = -1; |
lostpeer(); |
lostpeer(); |
|
|
int argc; |
int argc; |
char *argv[]; |
char *argv[]; |
{ |
{ |
fd_set mask; |
struct pollfd pfd[1]; |
int nfnd = 1; |
int nfnd = 1; |
|
|
FD_ZERO(&mask); |
pfd[0].fd = fileno(cin); |
|
pfd[0].events = POLLIN; |
while (nfnd > 0) { |
while (nfnd > 0) { |
FD_SET(fileno(cin), &mask); |
if ((nfnd = poll(pfd, 1, 0)) < 0) { |
if ((nfnd = empty(&mask, 0)) < 0) { |
|
warn("reset"); |
warn("reset"); |
code = -1; |
code = -1; |
lostpeer(); |
lostpeer(); |
} |
} else if (nfnd) { |
else if (nfnd) { |
|
(void)getreply(0); |
(void)getreply(0); |
} |
} |
} |
} |
|
|
{ |
{ |
char buf[BUFSIZ]; |
char buf[BUFSIZ]; |
int nfnd; |
int nfnd; |
fd_set mask; |
struct pollfd pfd[2]; |
|
|
if (cout == NULL) { |
if (cout == NULL) { |
warnx("Lost control connection for abort."); |
warnx("Lost control connection for abort."); |
|
|
warn("abort"); |
warn("abort"); |
fprintf(cout, "%cABOR\r\n", DM); |
fprintf(cout, "%cABOR\r\n", DM); |
(void)fflush(cout); |
(void)fflush(cout); |
FD_ZERO(&mask); |
pfd[0].fd = fileno(cin); |
FD_SET(fileno(cin), &mask); |
pfd[0].events = POLLIN; |
|
nfnd = 1; |
if (din) { |
if (din) { |
FD_SET(fileno(din), &mask); |
pfd[1].fd = fileno(din); |
|
pfd[1].events = POLLIN; |
|
nfnd++; |
} |
} |
if ((nfnd = empty(&mask, 10)) <= 0) { |
if ((nfnd = poll(pfd, nfnd, 10 * 1000)) <= 0) { |
if (nfnd < 0) { |
if (nfnd < 0) |
warn("abort"); |
warn("abort"); |
} |
|
if (ptabflg) |
if (ptabflg) |
code = -1; |
code = -1; |
lostpeer(); |
lostpeer(); |
} |
} |
if (din && FD_ISSET(fileno(din), &mask)) { |
if (din && (pfd[1].revents & POLLIN)) { |
while (read(fileno(din), buf, BUFSIZ) > 0) |
while (read(fileno(din), buf, BUFSIZ) > 0) |
/* LOOP */; |
/* LOOP */; |
} |
} |