dirent.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /**
  2. * This file has no copyright assigned and is placed in the Public Domain.
  3. * This file is part of the w64 mingw-runtime package.
  4. * No warranty is given; refer to the file DISCLAIMER within this package.
  5. */
  6. /* All the headers include this file. */
  7. #include <_mingw.h>
  8. #ifndef __STRICT_ANSI__
  9. #ifndef _DIRENT_H_
  10. #define _DIRENT_H_
  11. #pragma pack(push,_CRT_PACKING)
  12. #include <io.h>
  13. #ifndef RC_INVOKED
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. struct dirent
  18. {
  19. long d_ino; /* Always zero. */
  20. unsigned short d_reclen; /* Always zero. */
  21. unsigned short d_namlen; /* Length of name in d_name. */
  22. char* d_name; /* File name. */
  23. /* NOTE: The name in the dirent structure points to the name in the
  24. * finddata_t structure in the DIR. */
  25. };
  26. /*
  27. * This is an internal data structure. Good programmers will not use it
  28. * except as an argument to one of the functions below.
  29. * dd_stat field is now int (was short in older versions).
  30. */
  31. typedef struct
  32. {
  33. /* disk transfer area for this dir */
  34. struct _finddata_t dd_dta;
  35. /* dirent struct to return from dir (NOTE: this makes this thread
  36. * safe as long as only one thread uses a particular DIR struct at
  37. * a time) */
  38. struct dirent dd_dir;
  39. /* _findnext handle */
  40. long dd_handle;
  41. /*
  42. * Status of search:
  43. * 0 = not started yet (next entry to read is first entry)
  44. * -1 = off the end
  45. * positive = 0 based index of next entry
  46. */
  47. int dd_stat;
  48. /* given path for dir with search pattern (struct is extended) */
  49. char dd_name[1];
  50. } DIR;
  51. DIR* __cdecl opendir (const char*);
  52. struct dirent* __cdecl readdir (DIR*);
  53. int __cdecl closedir (DIR*);
  54. void __cdecl rewinddir (DIR*);
  55. long __cdecl telldir (DIR*);
  56. void __cdecl seekdir (DIR*, long);
  57. /* wide char versions */
  58. struct _wdirent
  59. {
  60. long d_ino; /* Always zero. */
  61. unsigned short d_reclen; /* Always zero. */
  62. unsigned short d_namlen; /* Length of name in d_name. */
  63. wchar_t* d_name; /* File name. */
  64. /* NOTE: The name in the dirent structure points to the name in the * wfinddata_t structure in the _WDIR. */
  65. };
  66. /*
  67. * This is an internal data structure. Good programmers will not use it
  68. * except as an argument to one of the functions below.
  69. */
  70. typedef struct
  71. {
  72. /* disk transfer area for this dir */
  73. struct _wfinddata_t dd_dta;
  74. /* dirent struct to return from dir (NOTE: this makes this thread
  75. * safe as long as only one thread uses a particular DIR struct at
  76. * a time) */
  77. struct _wdirent dd_dir;
  78. /* _findnext handle */
  79. long dd_handle;
  80. /*
  81. * Status of search:
  82. * 0 = not started yet (next entry to read is first entry)
  83. * -1 = off the end
  84. * positive = 0 based index of next entry
  85. */
  86. int dd_stat;
  87. /* given path for dir with search pattern (struct is extended) */
  88. wchar_t dd_name[1];
  89. } _WDIR;
  90. _WDIR* __cdecl _wopendir (const wchar_t*);
  91. struct _wdirent* __cdecl _wreaddir (_WDIR*);
  92. int __cdecl _wclosedir (_WDIR*);
  93. void __cdecl _wrewinddir (_WDIR*);
  94. long __cdecl _wtelldir (_WDIR*);
  95. void __cdecl _wseekdir (_WDIR*, long);
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif /* Not RC_INVOKED */
  100. #pragma pack(pop)
  101. #endif /* Not _DIRENT_H_ */
  102. #endif /* Not __STRICT_ANSI__ */