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