=========================================================================== * Uncompress input to output then close both files. */
(in, out)
| 433 | * Uncompress input to output then close both files. |
| 434 | */ |
| 435 | void gz_uncompress(in, out) |
| 436 | gzFile in; |
| 437 | FILE *out; |
| 438 | { |
| 439 | local char buf[BUFLEN]; |
| 440 | int len; |
| 441 | int err; |
| 442 | |
| 443 | for (;;) { |
| 444 | len = gzread(in, buf, sizeof(buf)); |
| 445 | if (len < 0) error (gzerror(in, &err)); |
| 446 | if (len == 0) break; |
| 447 | |
| 448 | if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { |
| 449 | error("failed fwrite"); |
| 450 | } |
| 451 | } |
| 452 | if (fclose(out)) error("failed fclose"); |
| 453 | |
| 454 | if (gzclose(in) != Z_OK) error("failed gzclose"); |
| 455 | } |
| 456 | |
| 457 | |
| 458 | /* =========================================================================== |
no test coverage detected