1 /* Copyright (c) 1982 Regents of the University of California */ 2 3 static char sccsid[] = "@(#)seekdir.c 4.1 02/21/82"; 4 5 #include <sys/types.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 lseek(dirp->dd_fd, loc & ~(DIRBLKSIZ - 1), 0); 18 dirp->dd_loc = loc % DIRBLKSIZ; 19 if (dirp->dd_loc != 0) 20 dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ); 21 } 22