#ifndef DIRENT_H
#define DIRENT_H

/*
**          $VER: dirent.h 1.3 (18.09.98)
**             Includes Release 45.00
**
**     Copyright © 1996/99 by CyberdyneSystems
**
**            written by Matthias Henze
**               All Rights Reserved
*/

#ifndef STORMAMIGA_H
  #include <stormamiga.h>
#endif
#ifndef SYS_DIRENT_H
  #include <sys/dirent.h>
#endif

#ifdef __cplusplus
  extern "C" {
#endif

#ifdef _POSIX_SOURCE
  typedef void *  DIR;
#else

/* backwards compatibility */
#define d_ino           d_fileno

/* definitions for library routines operating on directories. */
#define DIRBLKSIZ       1024

/* structure describing an open directory. */
typedef struct _dirdesc
{
  int     dd_fd;        /* file descriptor associated with directory */
  struct dirent dd_ent;
} DIR;

#define dirfd(dirp)     ((dirp)->dd_fd)
#endif /* _POSIX_SOURCE */

DIR     *opendir        (cchar *);
struct dirent *readdir  (DIR *);
void    rewinddir       (DIR *);
int     closedir        (DIR *);

#ifdef __cplusplus
  }
#endif

#ifdef STORMAMIGA_UNIXPATH
  __inline DIR *opendir_u (cchar *name)
  { return opendir        (name); }

  #define opendir(name)   opendir_u(UnixToAmigaPath(name))
#endif

#endif  /* DIRENT_H */

