25 lines
412 B
C
25 lines
412 B
C
|
/* closedir() Author: Kees J. Bot
|
||
|
* 24 Apr 1989
|
||
|
*/
|
||
|
#define nil 0
|
||
|
#include <lib.h>
|
||
|
#define close _close
|
||
|
#define closedir _closedir
|
||
|
#include <sys/types.h>
|
||
|
#include <dirent.h>
|
||
|
#include <unistd.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <errno.h>
|
||
|
|
||
|
int closedir(DIR *dp)
|
||
|
/* Finish reading a directory. */
|
||
|
{
|
||
|
int d;
|
||
|
|
||
|
if (dp == nil) { errno= EBADF; return -1; }
|
||
|
|
||
|
d= dp->_fd;
|
||
|
free((void *) dp);
|
||
|
return close(d);
|
||
|
}
|