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

Function Gem_display_file

outdated/win/gem/wingem.c:710–738  ·  view source on GitHub ↗
(fname, complain)

Source from the content-addressed store, hash-verified

708}
709
710void
711Gem_display_file(fname, complain)
712const char *fname;
713boolean complain;
714{
715 dlb *f;
716 char buf[BUFSZ];
717 char *cr;
718
719 f = dlb_fopen(fname, "r");
720 if (!f) {
721 if (complain)
722 pline("Cannot open \"%s\".", fname);
723 } else {
724 winid datawin;
725
726 datawin = Gem_create_nhwindow(NHW_TEXT);
727 while (dlb_fgets(buf, BUFSZ, f)) {
728 if ((cr = strchr(buf, '\n')) != 0)
729 *cr = 0;
730 if (strchr(buf, '\t') != 0)
731 (void) tabexpand(buf);
732 Gem_putstr(datawin, 0, buf);
733 }
734 (void) dlb_fclose(f);
735 Gem_display_nhwindow(datawin, FALSE);
736 Gem_destroy_nhwindow(datawin);
737 }
738}
739
740/*ARGSUSED*/
741/*

Callers

nothing calls this directly

Calls 9

dlb_fopenFunction · 0.85
Gem_create_nhwindowFunction · 0.85
dlb_fgetsFunction · 0.85
tabexpandFunction · 0.85
Gem_putstrFunction · 0.85
dlb_fcloseFunction · 0.85
Gem_display_nhwindowFunction · 0.85
Gem_destroy_nhwindowFunction · 0.85
plineFunction · 0.50

Tested by

no test coverage detected