|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 597 (0x255)
Types: TextFile
Names: »seekdir.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
└─⟦3658e588a⟧ »EurOpenD3/mail/mh/mh-6.7.tar.Z«
└─⟦c75e36ecb⟧
└─⟦this⟧ »mh-6.7/miscellany/libndir/seekdir.c«
static char sccsid[] = "@(#)seekdir.c 4.9 3/25/83";
#include <sys/param.h>
#include <dir.h>
/*
* seek to an entry in a directory.
* Only values returned by "telldir" should be passed to seekdir.
*/
void
seekdir(dirp, loc)
register DIR *dirp;
long loc;
{
long curloc, base, offset;
struct direct *dp;
extern long lseek();
curloc = telldir(dirp);
if (loc == curloc)
return;
base = loc & ~(DIRBLKSIZ - 1);
offset = loc & (DIRBLKSIZ - 1);
(void) lseek(dirp->dd_fd, base, 0);
dirp->dd_loc = 0;
while (dirp->dd_loc < offset) {
dp = readdir(dirp);
if (dp == NULL)
return;
}
}