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

Function genl_display_file

src/windows.c:1538–1555  ·  view source on GitHub ↗

possibly called to show usage info during command line processing when an interface hasn't yet been chosen and set up */

Source from the content-addressed store, hash-verified

1536/* possibly called to show usage info during command line processing when
1537 an interface hasn't yet been chosen and set up */
1538void
1539genl_display_file(const char *fname, boolean complain)
1540{
1541 char buf[BUFSZ];
1542 dlb *f = dlb_fopen(fname, "r");
1543
1544 if (!f) {
1545 if (complain) /* send complaint to stdout rather than to stderr */
1546 fprintf(stdout, "\nCannot open \"%s\".\n", fname);
1547 } else {
1548 /* straight copy to stdout, no pagination or other interaction */
1549 while (dlb_fgets(buf, BUFSZ, f)) {
1550 if (fputs(buf, stdout) < 0)
1551 break;
1552 }
1553 (void) dlb_fclose(f);
1554 }
1555}
1556
1557/*
1558 * Window port helper function for menu invert routines to move the decision

Callers 1

opt_usageFunction · 0.85

Calls 4

dlb_fopenFunction · 0.85
fprintfFunction · 0.85
dlb_fgetsFunction · 0.85
dlb_fcloseFunction · 0.85

Tested by

no test coverage detected