Annotation of 42BSD/usr.lib/sendmail/lib/libndir/seekdir.c, revision 1.1

1.1     ! root        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: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.