Annotation of 43BSDReno/contrib/isode-beta/dirent/closedir.c, revision 1.1.1.1

1.1       root        1: /*
                      2:        closedir -- close a directory stream
                      3: 
                      4:        last edit:      25-Apr-1987     D A Gwyn
                      5: */
                      6: 
                      7: #include       <sys/errno.h>
                      8: #include       <sys/types.h>
                      9: #include       "usr.dirent.h"
                     10: 
                     11: #ifndef        GETDENTS
                     12: typedef char   *pointer;               /* (void *) if you have it */
                     13: 
                     14: extern void    free();
                     15: extern int     close();
                     16: 
                     17: extern int     errno;
                     18: 
                     19: #ifndef NULL
                     20: #define        NULL    0
                     21: #endif
                     22: 
                     23: int
                     24: closedir( dirp )
                     25:        register DIR    *dirp;          /* stream from opendir() */
                     26:        {
                     27:        register int    fd;
                     28: 
                     29:        if ( dirp == NULL || dirp->dd_buf == NULL )
                     30:                {
                     31:                errno = EFAULT;
                     32:                return -1;              /* invalid pointer */
                     33:                }
                     34: 
                     35:        fd = dirp-> dd_fd;
                     36:        free( (pointer)dirp->dd_buf );
                     37:        free( (pointer)dirp );
                     38:        return close( fd );
                     39:        }
                     40: #endif

unix.superglobalmegacorp.com

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