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

Function find_file

src/dlb.c:174–194  ·  view source on GitHub ↗

* Look for the file in our directory structure. Return 1 if successful, * 0 if not found. Fill in the size and starting position. */

Source from the content-addressed store, hash-verified

172 * 0 if not found. Fill in the size and starting position.
173 */
174staticfn boolean
175find_file(const char *name, library **lib, long *startp, long *sizep)
176{
177 int i, j;
178 library *lp;
179
180 for (i = 0; i < MAX_LIBS && dlb_libs[i].fdata; i++) {
181 lp = &dlb_libs[i];
182 for (j = 0; j < lp->nentries; j++) {
183 if (FILENAME_CMP(name, lp->dir[j].fname) == 0) {
184 *lib = lp;
185 *startp = lp->dir[j].foffset;
186 *sizep = lp->dir[j].fsize;
187 return TRUE;
188 }
189 }
190 }
191 *lib = (library *) 0;
192 *startp = *sizep = 0;
193 return FALSE;
194}
195
196/*
197 * Open the library of the given name and fill in the given library

Callers 1

lib_dlb_fopenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected