version 1.31, 2003/06/30 03:42:05 |
version 1.32, 2003/07/08 00:30:12 |
|
|
if ((ofd = open(out, O_WRONLY|O_CREAT, S_IWUSR)) < 0) { |
if ((ofd = open(out, O_WRONLY|O_CREAT, S_IWUSR)) < 0) { |
if (verbose >= 0) |
if (verbose >= 0) |
warn("%s", out); |
warn("%s", out); |
|
(void) close(ifd); |
return (-1); |
return (-1); |
} |
} |
|
|
|
|
if (verbose >= 0) |
if (verbose >= 0) |
warnx("%s: won't write compressed data to terminal", |
warnx("%s: won't write compressed data to terminal", |
out); |
out); |
|
(void) close(ofd); |
|
(void) close(ifd); |
return (-1); |
return (-1); |
} |
} |
|
|
if ((cookie = (*method->open)(ofd, "w", bits)) != NULL) { |
if ((cookie = (*method->open)(ofd, "w", bits)) == NULL) { |
|
if (verbose >= 0) |
while ((nr = read(ifd, buf, sizeof(buf))) > 0) |
warn("%s", in); |
if ((method->write)(cookie, buf, nr) != nr) { |
(void) close(ofd); |
if (verbose >= 0) |
(void) close(ifd); |
warn("%s", out); |
return (-1); |
error++; |
|
break; |
|
} |
|
} |
} |
|
|
if (cookie == NULL || nr < 0) { |
while ((nr = read(ifd, buf, sizeof(buf))) > 0) |
if (!error && verbose >= 0) |
if ((method->write)(cookie, buf, nr) != nr) { |
|
if (verbose >= 0) |
|
warn("%s", out); |
|
error++; |
|
break; |
|
} |
|
|
|
if (!error && nr < 0) { |
|
if (verbose >= 0) |
warn("%s", in); |
warn("%s", in); |
error++; |
error++; |
} |
} |
|
|
if (cookie == NULL || (method->close)(cookie)) { |
if ((method->close)(cookie)) { |
if (!error && verbose >= 0) |
if (!error && verbose >= 0) |
warn("%s", out); |
warn("%s", out); |
error++; |
error++; |
(void) close(ofd); |
|
} |
} |
|
|
if (close(ifd)) { |
if (close(ifd)) { |
if (!error && verbose >= 0) |
if (!error && verbose >= 0) |
warn("%s", out); |
warn("%s", in); |
error++; |
error++; |
} |
} |
|
|
return (error); |
return (error); |
} |
} |
|
|
|
|
return -1; |
return -1; |
} |
} |
|
|
if ((cookie = (*method->open)(ifd, "r", bits)) != NULL) { |
if ((cookie = (*method->open)(ifd, "r", bits)) == NULL) { |
if ((ofd = open(out, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR)) < 0) { |
if (verbose >= 0) |
|
warn("%s", in); |
|
error++; |
|
close (ifd); |
|
return -1; |
|
} |
|
|
|
if ((ofd = open(out, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR)) < 0) { |
|
if (verbose >= 0) |
|
warn("%s", in); |
|
(method->close)(cookie); |
|
return -1; |
|
} |
|
|
|
while ((nr = (method->read)(cookie, buf, sizeof(buf))) > 0) |
|
if (write(ofd, buf, nr) != nr) { |
if (verbose >= 0) |
if (verbose >= 0) |
warn("%s", in); |
warn("%s", out); |
(method->close)(cookie); |
error++; |
return -1; |
break; |
} |
} |
|
|
while ((nr = (method->read)(cookie, buf, sizeof(buf))) > 0) |
if (!error && nr < 0) { |
if (write(ofd, buf, nr) != nr) { |
if (verbose >= 0) |
if (verbose >= 0) |
warnx("%s: %s", in, |
warn("%s", out); |
errno == EINVAL ? "crc error" : strerror(errno)); |
error++; |
error++; |
break; |
|
} |
|
} |
} |
|
|
if (cookie == NULL || (method->close)(cookie) || nr < 0) { |
if ((method->close)(cookie)) { |
if (!error && verbose >= 0) |
if (!error && verbose >= 0) |
warnx("%s: %s", in, |
warnx("%s", in); |
errno == EINVAL ? "crc error" : strerror(errno)); |
|
error++; |
error++; |
close (ifd); |
|
} |
} |
|
|
if (close(ofd)) { |
if (close(ofd)) { |