dirent.h 3.1 KB

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