minix/lib/posix/_closedir.c

25 lines
412 B
C
Raw Normal View History

2005-04-21 16:53:53 +02:00
/* 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);
}