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 a part of the mingw-runtime package. 5 * 6 * The mingw-runtime package and its code is distributed in the hope that it 7 * will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR 8 * IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to 9 * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 * 11 * You are free to use this package and its code without limitation. 12 */ 13#ifndef _DIRENT_H_ 14#define _DIRENT_H_ 15#include <io.h> 16 17#define PATH_MAX 512 18 19#define __MINGW_NOTHROW 20 21#ifndef RC_INVOKED 22 23#ifdef __cplusplus 24extern"C"{ 25#endif 26 27struct dirent 28{ 29long d_ino;/* Always zero. */ 30unsigned short d_reclen;/* Always zero. */ 31unsigned short d_namlen;/* Length of name in d_name. */ 32char d_name[FILENAME_MAX];/* File name. */ 33}; 34 35/* 36 * This is an internal data structure. Good programmers will not use it 37 * except as an argument to one of the functions below. 38 * dd_stat field is now int (was short in older versions). 39 */ 40typedefstruct 41{ 42/* disk transfer area for this dir */ 43struct _finddata_t dd_dta; 44 45/* dirent struct to return from dir (NOTE: this makes this thread 46 * safe as long as only one thread uses a particular DIR struct at 47 * a time) */ 48struct dirent dd_dir; 49 50/* _findnext handle */ 51long dd_handle; 52 53/* 54 * Status of search: 55 * 0 = not started yet (next entry to read is first entry) 56 * -1 = off the end 57 * positive = 0 based index of next entry 58 */ 59int dd_stat; 60 61/* given path for dir with search pattern (struct is extended) */ 62char dd_name[PATH_MAX+3]; 63}DIR; 64 65DIR* __cdecl __MINGW_NOTHROW opendir(const char*); 66struct dirent* __cdecl __MINGW_NOTHROW readdir(DIR*); 67int __cdecl __MINGW_NOTHROW closedir(DIR*); 68void __cdecl __MINGW_NOTHROW rewinddir(DIR*); 69long __cdecl __MINGW_NOTHROW telldir(DIR*); 70void __cdecl __MINGW_NOTHROW seekdir(DIR*,long); 71 72 73/* wide char versions */ 74 75struct _wdirent 76{ 77long d_ino;/* Always zero. */ 78unsigned short d_reclen;/* Always zero. */ 79unsigned short d_namlen;/* Length of name in d_name. */ 80wchar_t d_name[FILENAME_MAX];/* File name. */ 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 */ 87typedefstruct 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) */ 95struct _wdirent dd_dir; 96 97/* _findnext handle */ 98long 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 */ 106int dd_stat; 107 108/* given path for dir with search pattern (struct is extended) */ 109wchar_t dd_name[1]; 110} _WDIR; 111 112 113 114_WDIR* __cdecl __MINGW_NOTHROW _wopendir(const wchar_t*); 115struct _wdirent* __cdecl __MINGW_NOTHROW _wreaddir(_WDIR*); 116int __cdecl __MINGW_NOTHROW _wclosedir(_WDIR*); 117void __cdecl __MINGW_NOTHROW _wrewinddir(_WDIR*); 118long __cdecl __MINGW_NOTHROW _wtelldir(_WDIR*); 119void __cdecl __MINGW_NOTHROW _wseekdir(_WDIR*,long); 120 121 122#ifdef __cplusplus 123} 124#endif 125 126#endif/* Not RC_INVOKED */ 127 128#endif/* Not _DIRENT_H_ */