1: /*
   2:  * static char sccsid[] = "@(#)seekdir.c 4.6 9/12/82";
   3:  */
   4: 
   5: #include <sys/param.h>
   6: #include <ndir.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 base, offset;
  18:     struct direct *dp;
  19: 
  20: /* rti!trt: Always seek.  Slower, but safer. This may even fix a bug.
  21: 	if (loc == telldir(dirp))
  22: 		return;
  23:  */
  24:     base = loc & ~(DIRBLKSIZ - 1);
  25:     offset = loc & (DIRBLKSIZ - 1);
  26:     lseek(dirp->dd_fd, base, 0);
  27:     dirp->dd_loc = 0;
  28:     while (dirp->dd_loc < offset) {
  29:         dp = readdir(dirp);
  30:         if (dp == NULL)
  31:             return;
  32:     }
  33: }

Defined functions

seekdir defined in line 12; used 2 times
Last modified: 1983-07-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 610
Valid CSS Valid XHTML 1.0 Strict