readdir.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #define php_readdir_r readdir_r
  13. /* struct dirent - same as Unix */
  14. struct dirent {
  15. long d_ino; /* inode (always 1 in WIN32) */
  16. off_t d_off; /* offset to this dirent */
  17. unsigned short d_reclen; /* length of d_name */
  18. char d_name[1]; /* null terminated filename in the current encoding, glyph number <= 255 wchar_t's + \0 byte */
  19. };
  20. /* typedef DIR - not the same as Unix */
  21. struct DIR_W32 {
  22. HANDLE handle; /* _findfirst/_findnext handle */
  23. uint16_t offset; /* offset into directory */
  24. uint8_t finished; /* 1 if there are not more files */
  25. WIN32_FIND_DATAW fileinfo; /* from _findfirst/_findnext */
  26. wchar_t *dirw; /* the dir we are reading */
  27. struct dirent dent; /* the dirent to return */
  28. };
  29. typedef struct DIR_W32 DIR;
  30. /* Function prototypes */
  31. DIR *opendir(const char *);
  32. struct dirent *readdir(DIR *);
  33. int readdir_r(DIR *, struct dirent *, struct dirent **);
  34. int closedir(DIR *);
  35. int rewinddir(DIR *);
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif /* READDIR_H */
  40. /*
  41. * Local variables:
  42. * tab-width: 4
  43. * c-basic-offset: 4
  44. * End:
  45. * vim600: sw=4 ts=4 fdm=marker
  46. * vim<600: sw=4 ts=4
  47. */