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

Function lib_dlb_fseek

src/dlb.c:323–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323staticfn int
324lib_dlb_fseek(dlb *dp, long pos, int whence)
325{
326 long curpos;
327
328 switch (whence) {
329 case SEEK_CUR:
330 curpos = dp->mark + pos;
331 break;
332 case SEEK_END:
333 curpos = dp->size - pos;
334 break;
335 default: /* set */
336 curpos = pos;
337 break;
338 }
339 if (curpos < 0)
340 curpos = 0;
341 if (curpos > dp->size)
342 curpos = dp->size;
343
344 dp->mark = curpos;
345 return 0;
346}
347
348staticfn char *
349lib_dlb_fgets(char *buf, int len, dlb *dp)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected