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