-
Notifications
You must be signed in to change notification settings - Fork 0
/
dirent2.h
78 lines (62 loc) · 2.3 KB
/
dirent2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/****************************************************************************
*
* Copyright (c) 2010 Dave Hylands <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See README and COPYING for more details.
*
****************************************************************************/
/**
*
* @file dirent.h
*
* @brief The mingw version of dirent and friends doesn't include the
* the d_type field. So we make our own version.
*
****************************************************************************/
#if !defined( MINGW_DIRENT_H )
#define MINGW_DIRENT_H /**< Include Guard */
/* ---- Include Files ---------------------------------------------------- */
#include <sys/types.h>
#include <io.h>
/* ---- Constants and Types ---------------------------------------------- */
#define DT_DIR 004
#define DT_REG 010
struct dirent2 {
long d_ino; /* Always zero. */
off_t d_off; /* Always zero. */
unsigned short d_reclen; /* Always zero */
unsigned char d_type; /* Type of file */
char d_name[2048]; /* File name. */
};
typedef struct {
/* dd_findsata stores the information needed for the
* _findfirst/_findnext API
*/
void* dd_finddata;
/* dd_dirent stores the dirent returned from readdir, which makes
* this threadsafe as long as only one thread uses this particular
* DIR entry.
*/
struct dirent2 dd_dirent;
/* dd_dirpattern contains the directory pattern that was passed to
* FindFirstFile.
*/
char* dd_dirpattern;
/* dd_handle is the HANDLE returned by FindFirstFile
*/
void* dd_handle;
} DIR2;
/* ---- Variable Externs ------------------------------------------------- */
/* ---- Function Prototypes ---------------------------------------------- */
DIR2* opendir2( const char* dirName );
struct dirent2* readdir2( DIR2* dir );
int closedir2( DIR2* dir );
/** @} */
#endif /* MINGW_DIRENT_H */