/* Written by Stone Horse. Public domain */
#ifndef DIRENT_H
#define DIRENT_H 1

#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LNK 10
#define DT_SOCK 12

#define S_IRUSR 00400 /* read by owner. */
#define S_IWUSR 00200 /* write by owner. */
#define S_IXUSR 00100 /* execute by owner. */
#define S_IRGRP 00040 /* read by group. */
#define S_IWGRP 00020 /* write by group. */
#define S_IXGRP 00010 /* execute by group. */
#define S_IROTH 00004 /* read by others. */
#define S_IWOTH 00002 /* write by others. */
#define S_IXOTH 00001 /* execute by others. */

struct dirent {
	unsigned long d_ino;
	unsigned long d_off;
	unsigned short d_reclen;
	char d_name[257];
	/* The d_type offset is (d_reclen - 1) */
};

_PROTOTYPE(extern int chdir, (_CONST char *path));
_PROTOTYPE(extern int getdents, (unsigned int fd, struct dirent *buf, unsigned int len));
_PROTOTYPE(extern int unlink, (_CONST char *pathname));
_PROTOTYPE(extern int getcwd, (char *buf, unsigned int size));
_PROTOTYPE(extern int chown, (_CONST char *pathname, unsigned int owner, unsigned int group));
_PROTOTYPE(extern int fchown, (unsigned int fd, unsigned int owner, int group));
_PROTOTYPE(extern int access, (_CONST char *pathname, unsigned int mode));
_PROTOTYPE(extern int chmod, (_CONST char *pathname, unsigned int mode));
_PROTOTYPE(extern int fchmod, (unsigned int fd, unsigned int mode));

#endif
