Annotation of 43BSDReno/contrib/isode-beta/dirent/rewinddir.c, revision 1.1

1.1     ! root        1: /*
        !             2:        rewinddir -- rewind a directory stream
        !             3: 
        !             4:        last edit:      25-Apr-1987     D A Gwyn
        !             5: 
        !             6:        This is not simply a call to seekdir(), because seekdir()
        !             7:        will use the current buffer whenever possible and we need
        !             8:        rewinddir() to forget about buffered data.
        !             9: */
        !            10: 
        !            11: #include       <sys/errno.h>
        !            12: #include       <sys/types.h>
        !            13: #include       "usr.dirent.h"
        !            14: 
        !            15: #ifndef        GETDENTS
        !            16: extern off_t   lseek();
        !            17: 
        !            18: extern int     errno;
        !            19: 
        !            20: #ifndef NULL
        !            21: #define        NULL    0
        !            22: #endif
        !            23: 
        !            24: #ifndef SEEK_SET
        !            25: #define        SEEK_SET        0
        !            26: #endif
        !            27: 
        !            28: void
        !            29: rewinddir( dirp )
        !            30:        register DIR            *dirp;  /* stream from opendir() */
        !            31:        {
        !            32:        if ( dirp == NULL || dirp->dd_buf == NULL )
        !            33:                {
        !            34:                errno = EFAULT;
        !            35:                return;                 /* invalid pointer */
        !            36:                }
        !            37: 
        !            38:        dirp->dd_loc = dirp->dd_size = 0;       /* invalidate buffer */
        !            39:        (void)lseek( dirp->dd_fd, (off_t)0, SEEK_SET ); /* may set errno */
        !            40:        }
        !            41: #endif

unix.superglobalmegacorp.com

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