MCPcopy Create free account
hub / github.com/NetHack/NetHack / redirect

Function redirect

src/files.c:1562–1581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1560#ifdef COMPRESS /* external compression */
1561
1562staticfn void
1563redirect(
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

Callers 1

docompress_fileFunction · 0.85

Calls 2

fprintfFunction · 0.85
nh_terminateFunction · 0.70

Tested by

no test coverage detected