| 1560 | #ifdef COMPRESS /* external compression */ |
| 1561 | |
| 1562 | staticfn void |
| 1563 | redirect( |
| 1564 | const char *filename, |
| 1565 | const char *mode, |
| 1566 | FILE *stream, |
| 1567 | boolean uncomp) |
| 1568 | { |
| 1569 | if (freopen(filename, mode, stream) == (FILE *) 0) { |
| 1570 | const char *details; |
| 1571 | |
| 1572 | #if defined(NHSTDC) && !defined(NOTSTDC) |
| 1573 | if ((details = strerror(errno)) == 0) |
| 1574 | #endif |
| 1575 | details = ""; |
| 1576 | (void) fprintf(stderr, |
| 1577 | "freopen of %s for %scompress failed; (%d) %s\n", |
| 1578 | filename, uncomp ? "un" : "", errno, details); |
| 1579 | nh_terminate(EXIT_FAILURE); |
| 1580 | } |
| 1581 | } |
| 1582 | |
| 1583 | /* |
| 1584 | * using system() is simpler, but opens up security holes and causes |
no test coverage detected