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 #include <crtdefs.h> 7 8 #ifndef __STRICT_ANSI__ 9 10 #ifndef _DIRENT_H_ 11 #define _DIRENT_H_ 12 13 14 #pragma pack(push,_CRT_PACKING) 15 16 #include <io.h> 17 18 #ifndef RC_INVOKED 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 struct dirent 25 { 26 long d_ino; /* Always zero. */ 27 unsigned short d_reclen; /* Always zero. */ 28 unsigned short d_namlen; /* Length of name in d_name. */ 29 char* d_name; /* File name. */ 30 /* NOTE: The name in the dirent structure points to the name in the 31 * finddata_t structure in the DIR. */ 32 }; 33 34 /* 35 * This is an internal data structure. Good programmers will not use it 36 * except as an argument to one of the functions below. 37 * dd_stat field is now int (was short in older versions). 38 */ 39 typedef struct 40 { 41 /* disk transfer area for this dir */ 42 struct _finddata_t dd_dta; 43 44 /* dirent struct to return from dir (NOTE: this makes this thread 45 * safe as long as only one thread uses a particular DIR struct at 46 * a time) */ 47 struct dirent dd_dir; 48 49 /* _findnext handle */ 50 long dd_handle; 51 52 /* 53 * Status of search: 54 * 0 = not started yet (next entry to read is first entry) 55 * -1 = off the end 56 * positive = 0 based index of next entry 57 */ 58 int dd_stat; 59 60 /* given path for dir with search pattern (struct is extended) */ 61 char dd_name[1]; 62 } DIR; 63 64 DIR* __cdecl opendir (const char*); 65 struct dirent* __cdecl readdir (DIR*); 66 int __cdecl closedir (DIR*); 67 void __cdecl rewinddir (DIR*); 68 long __cdecl telldir (DIR*); 69 void __cdecl seekdir (DIR*, long); 70 71 72 /* wide char versions */ 73 74 struct _wdirent 75 { 76 long d_ino; /* Always zero. */ 77 unsigned short d_reclen; /* Always zero. */ 78 unsigned short d_namlen; /* Length of name in d_name. */ 79 wchar_t* d_name; /* File name. */ 80 /* NOTE: The name in the dirent structure points to the name in the * wfinddata_t structure in the _WDIR. */ 81 }; 82 83 /* 84 * This is an internal data structure. Good programmers will not use it 85 * except as an argument to one of the functions below. 86 */ 87 typedef struct 88 { 89 /* disk transfer area for this dir */ 90 struct _wfinddata_t dd_dta; 91 92 /* dirent struct to return from dir (NOTE: this makes this thread 93 * safe as long as only one thread uses a particular DIR struct at 94 * a time) */ 95 struct _wdirent dd_dir; 96 97 /* _findnext handle */ 98 long dd_handle; 99 100 /* 101 * Status of search: 102 * 0 = not started yet (next entry to read is first entry) 103 * -1 = off the end 104 * positive = 0 based index of next entry 105 */ 106 int dd_stat; 107 108 /* given path for dir with search pattern (struct is extended) */ 109 wchar_t dd_name[1]; 110 } _WDIR; 111 112 113 114 _WDIR* __cdecl _wopendir (const wchar_t*); 115 struct _wdirent* __cdecl _wreaddir (_WDIR*); 116 int __cdecl _wclosedir (_WDIR*); 117 void __cdecl _wrewinddir (_WDIR*); 118 long __cdecl _wtelldir (_WDIR*); 119 void __cdecl _wseekdir (_WDIR*, long); 120 121 122 #ifdef __cplusplus 123 } 124 #endif 125 126 #endif /* Not RC_INVOKED */ 127 128 #pragma pack(pop) 129 130 #endif /* Not _DIRENT_H_ */ 131 132 133 #endif /* Not __STRICT_ANSI__ */ 134 135