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

Function dlb_fopen

src/dlb.c:455–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455dlb *
456dlb_fopen(const char *name, const char *mode)
457{
458 FILE *fp;
459 dlb *dp;
460
461 if (!dlb_initialized)
462 return (dlb *) 0;
463
464 /* only support reading; ignore possible binary flag */
465 if (!mode || mode[0] != 'r')
466 return (dlb *) 0;
467
468 dp = (dlb *) alloc(sizeof(dlb));
469 if (do_dlb_fopen(dp, name, mode))
470 dp->fp = (FILE *) 0;
471 else if ((fp = fopen_datafile(name, mode, DATAPREFIX)) != 0)
472 dp->fp = fp;
473 else {
474 /* can't find anything */
475 free((genericptr_t) dp);
476 dp = (dlb *) 0;
477 }
478
479 return dp;
480}
481
482int
483dlb_fclose(dlb *dp)

Callers 15

tty_display_fileFunction · 0.85
qt_display_fileMethod · 0.85
mswin_display_fileFunction · 0.85
curses_view_fileFunction · 0.85
X11_display_fileFunction · 0.85
amii_display_fileFunction · 0.85
nhl_loadluaFunction · 0.85
genl_display_fileFunction · 0.85
read_tributeFunction · 0.85
doextversionFunction · 0.85
checkfileFunction · 0.85

Calls 2

allocFunction · 0.70
fopen_datafileFunction · 0.70

Tested by

no test coverage detected