readdir.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef READDIR_H
  2. #define READDIR_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /*
  7. * Structures and types used to implement opendir/readdir/closedir
  8. * on Windows.
  9. */
  10. #include <config.w32.h>
  11. #include "ioutil.h"
  12. /* struct dirent - same as Unix */
  13. struct dirent {
  14. long d_ino; /* inode (always 1 in WIN32) */
  15. off_t d_off; /* offset to this dirent */
  16. unsigned short d_reclen; /* length of d_name */
  17. char d_name[1]; /* null terminated filename in the current encoding, glyph number <= 255 wchar_t's + \0 byte */
  18. };
  19. /* typedef DIR - not the same as Unix */
  20. struct DIR_W32 {
  21. HANDLE handle; /* _findfirst/_findnext handle */
  22. uint32_t offset; /* offset into directory */
  23. uint8_t finished; /* 1 if there are not more files */
  24. WIN32_FIND_DATAW fileinfo; /* from _findfirst/_findnext */
  25. wchar_t *dirw; /* the dir we are reading */
  26. struct dirent dent; /* the dirent to return */
  27. };
  28. typedef struct DIR_W32 DIR;
  29. /* Function prototypes */
  30. DIR *opendir(const char *);
  31. struct dirent *readdir(DIR *);
  32. int closedir(DIR *);
  33. int rewinddir(DIR *);
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif /* READDIR_H */