Annotation of coherent/b/lib/libc/ndir/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: #ifdef COHERENT
                      8: #include       <errno.h>
                      9: #else
                     10: #include       <sys/errno.h>
                     11: #endif
                     12: 
                     13: #include       <sys/types.h>
                     14: #include       "dirent.h"
                     15: 
                     16: typedef char   *pointer;               /* (void *) if you have it */
                     17: 
                     18: extern void    free();
                     19: extern int     close();
                     20: 
                     21: extern int     errno;
                     22: 
                     23: #ifndef NULL
                     24: #define        NULL    0
                     25: #endif
                     26: 
                     27: int
                     28: closedir( dirp )
                     29:        register DIR    *dirp;          /* stream from opendir() */
                     30:        {
                     31:        if ( dirp == NULL || dirp->dd_buf == NULL )
                     32:                {
                     33:                errno = EFAULT;
                     34:                return -1;              /* invalid pointer */
                     35:                }
                     36: 
                     37:        free( (pointer)dirp->dd_buf );
                     38:        free( (pointer)dirp );
                     39:        return close( dirp->dd_fd );
                     40:        }

unix.superglobalmegacorp.com

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