version 1.68, 2008/03/10 22:56:43 |
version 1.69, 2008/04/12 21:20:58 |
|
|
volatile off_t hashbytes; |
volatile off_t hashbytes; |
char * volatile lmode; |
char * volatile lmode; |
char buf[BUFSIZ], *bufp; |
char buf[BUFSIZ], *bufp; |
int oprogress; |
int oprogress, serrno; |
|
|
hashbytes = mark; |
hashbytes = mark; |
direction = "sent"; |
direction = "sent"; |
|
|
|
|
case TYPE_I: |
case TYPE_I: |
case TYPE_L: |
case TYPE_L: |
errno = d = 0; |
d = 0; |
while ((c = read(fileno(fin), buf, sizeof(buf))) > 0) { |
while ((c = read(fileno(fin), buf, sizeof(buf))) > 0) { |
may_send_noop_char(); |
may_send_noop_char(); |
bytes += c; |
bytes += c; |
|
|
(void)fflush(ttyout); |
(void)fflush(ttyout); |
} |
} |
} |
} |
|
if (c == -1 || d == -1) |
|
serrno = errno; |
if (hash && (!progress || filesize < 0) && bytes > 0) { |
if (hash && (!progress || filesize < 0) && bytes > 0) { |
if (bytes < mark) |
if (bytes < mark) |
(void)putc('#', ttyout); |
(void)putc('#', ttyout); |
|
|
(void)fflush(ttyout); |
(void)fflush(ttyout); |
} |
} |
if (c < 0) |
if (c < 0) |
warn("local: %s", local); |
warnx("local: %s: %s", local, strerror(serrno)); |
if (d < 0) { |
if (d < 0) { |
if (errno != EPIPE) |
if (serrno != EPIPE) |
warn("netout"); |
warnx("netout: %s", strerror(serrno)); |
bytes = -1; |
bytes = -1; |
} |
} |
break; |
break; |
|
|
} |
} |
#endif |
#endif |
} |
} |
|
if (ferror(fin) || ferror(dout)) |
|
serrno = errno; |
if (hash && (!progress || filesize < 0)) { |
if (hash && (!progress || filesize < 0)) { |
if (bytes < hashbytes) |
if (bytes < hashbytes) |
(void)putc('#', ttyout); |
(void)putc('#', ttyout); |
|
|
(void)fflush(ttyout); |
(void)fflush(ttyout); |
} |
} |
if (ferror(fin)) |
if (ferror(fin)) |
warn("local: %s", local); |
warnx("local: %s: %s", local, strerror(serrno)); |
if (ferror(dout)) { |
if (ferror(dout)) { |
if (errno != EPIPE) |
if (errno != EPIPE) |
warn("netout"); |
warnx("netout: %s", strerror(serrno)); |
bytes = -1; |
bytes = -1; |
} |
} |
break; |
break; |
|
|
FILE * volatile fout, * volatile din; |
FILE * volatile fout, * volatile din; |
int (* volatile closefunc)(FILE *); |
int (* volatile closefunc)(FILE *); |
volatile sig_t oldinti, oldintr, oldintp; |
volatile sig_t oldinti, oldintr, oldintp; |
int c, d; |
int c, d, serrno; |
volatile int is_retr, tcrflag, bare_lfs; |
volatile int is_retr, tcrflag, bare_lfs; |
static size_t bufsize; |
static size_t bufsize; |
static char *buf; |
static char *buf; |
|
|
oldinti = signal(SIGINFO, psummary); |
oldinti = signal(SIGINFO, psummary); |
if (ignorespecial || (strcmp(local, "-") && *local != '|')) { |
if (ignorespecial || (strcmp(local, "-") && *local != '|')) { |
if (access(local, W_OK) < 0) { |
if (access(local, W_OK) < 0) { |
char *dir = strrchr(local, '/'); |
char *dir; |
|
|
if (errno != ENOENT && errno != EACCES) { |
if (errno != ENOENT && errno != EACCES) { |
warn("local: %s", local); |
warn("local: %s", local); |
|
|
code = -1; |
code = -1; |
return; |
return; |
} |
} |
|
dir = strrchr(local, '/'); |
if (dir != NULL) |
if (dir != NULL) |
*dir = 0; |
*dir = 0; |
d = access(dir == local ? "/" : dir ? local : ".", W_OK); |
d = access(dir == local ? "/" : dir ? local : ".", W_OK); |
|
|
(void)fflush(ttyout); |
(void)fflush(ttyout); |
} |
} |
} |
} |
|
if (c == -1 || d < c) |
|
serrno = errno; |
if (hash && (!progress || filesize < 0) && bytes > 0) { |
if (hash && (!progress || filesize < 0) && bytes > 0) { |
if (bytes < mark) |
if (bytes < mark) |
(void)putc('#', ttyout); |
(void)putc('#', ttyout); |
|
|
(void)fflush(ttyout); |
(void)fflush(ttyout); |
} |
} |
if (c < 0) { |
if (c < 0) { |
if (errno != EPIPE) |
if (serrno != EPIPE) |
warn("netin"); |
warnx("netin: %s", strerror(serrno)); |
bytes = -1; |
bytes = -1; |
} |
} |
if (d < c) { |
if (d < c) { |
if (d < 0) |
if (d < 0) |
warn("local: %s", local); |
warnx("local: %s: %s", local, strerror(serrno)); |
else |
else |
warnx("%s: short write", local); |
warnx("%s: short write", local); |
} |
} |
|
|
goto done; |
goto done; |
n = restart_point; |
n = restart_point; |
for (i = 0; i++ < n;) { |
for (i = 0; i++ < n;) { |
if ((ch = fgetc(fout)) == EOF) |
if ((ch = fgetc(fout)) == EOF) { |
|
if (!ferror(fout)) |
|
errno = 0; |
goto done; |
goto done; |
|
} |
if (ch == '\n') |
if (ch == '\n') |
i++; |
i++; |
} |
} |
if (fseek(fout, 0L, SEEK_CUR) < 0) { |
if (fseek(fout, 0L, SEEK_CUR) < 0) { |
done: |
done: |
warn("local: %s", local); |
if (errno) |
|
warn("local: %s", local); |
|
else |
|
warnx("local: %s", local); |
progress = oprogress; |
progress = oprogress; |
preserve = opreserve; |
preserve = opreserve; |
if (closefunc != NULL) |
if (closefunc != NULL) |
|
|
contin2: ; |
contin2: ; |
} |
} |
break2: |
break2: |
|
if (ferror(din) || ferror(fout)) |
|
serrno = errno; |
if (bare_lfs) { |
if (bare_lfs) { |
fprintf(ttyout, |
fprintf(ttyout, |
"WARNING! %d bare linefeeds received in ASCII mode.\n", bare_lfs); |
"WARNING! %d bare linefeeds received in ASCII mode.\n", bare_lfs); |
|
|
(void)fflush(ttyout); |
(void)fflush(ttyout); |
} |
} |
if (ferror(din)) { |
if (ferror(din)) { |
if (errno != EPIPE) |
if (serrno != EPIPE) |
warn("netin"); |
warnx("netin: %s", strerror(serrno)); |
bytes = -1; |
bytes = -1; |
} |
} |
if (ferror(fout)) |
if (ferror(fout)) |
warn("local: %s", local); |
warnx("local: %s: %s", local, strerror(serrno)); |
break; |
break; |
} |
} |
progressmeter(1); |
progressmeter(1); |