1: /* Copyright (c) 1982 Regents of the University of California */
   2: 
   3: static char sccsid[] = "@(#)seekdir.c 4.6 9/12/82";
   4: 
   5: #include <sys/param.h>
   6: #include <dir.h>
   7: 
   8: /*
   9:  * seek to an entry in a directory.
  10:  * Only values returned by ``telldir'' should be passed to seekdir.
  11:  */
  12: void
  13: seekdir(dirp, loc)
  14:     register DIR *dirp;
  15:     long loc;
  16: {
  17:     long curloc, base, offset;
  18:     struct direct *dp;
  19: 
  20:     curloc = telldir(dirp);
  21:     if (loc == curloc)
  22:         return;
  23:     base = loc & ~(DIRBLKSIZ - 1);
  24:     offset = loc & (DIRBLKSIZ - 1);
  25:     lseek(dirp->dd_fd, base, 0);
  26:     dirp->dd_loc = 0;
  27:     while (dirp->dd_loc < offset) {
  28:         dp = readdir(dirp);
  29:         if (dp == NULL)
  30:             return;
  31:     }
  32: }

Defined functions

seekdir defined in line 12; used 2 times

Defined variables

sccsid defined in line 3; never used
Last modified: 1983-12-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 651
Valid CSS Valid XHTML 1.0 Strict