/*
 * dirent.c
 */


#include<sys/types.h>
#include<callgate.h>

#include<stdlib.h>
#include<string.h>
#include<dirent.h>
#include<errno.h>


extern int _readdir(DIR*,char*);
static struct dirent dirent;


struct dirent *readdir(DIR *dirp)
{
	int rest;


	rest = _readdir(dirp,dirent.d_name);
	if (rest == -1)
		return NULL;

	if(*dirent.d_name == '\0')
		return NULL;
	dirent.d_namlen = strlen(dirent.d_name);
	dirent.d_fileno = (int)dirp;

	return &dirent;
}
