#ifndef _SYS_DIRENT_H
# define _SYS_DIRENT_H

#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif

/*
 * This file was written to be compatible with the BSD directory
 * routines, so it looks like it.  But it was written from scratch.
 * Sean Eric Fagan, sef@Kithrup.COM
 */
typedef struct _dirdesc {
	int	  dd_fd;
	long  dd_loc;
	long  dd_size;
	char *dd_buf;
	int	  dd_len;
	long  dd_seek;
} DIR;

#define __dirfd(dp)	((dp)->dd_fd)

DIR*   opendir (const char *);
struct dirent *readdir (DIR *);
off_t  telldir (DIR *);
void   seekdir (DIR *, off_t);
void   rewinddir (DIR *);
int    closedir (DIR *);

struct dirent {
	ino_t	d_ino;
	off_t	d_off;
	unsigned short	d_reclen;
	char	d_name[ 256 ];
};

typedef struct dirent dirent_t;

int getdents(int, struct dirent *, unsigned);

#ifdef __cplusplus
}
#endif

#endif

