summaryrefslogtreecommitdiff
path: root/src/lib/evil/dirent.h
blob: 9c58019b525ce72804d0e4a49704ff8a6b6c44a2 (plain) (blame)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#ifndef __EVIL_DIRENT_H__
#define __EVIL_DIRENT_H__

#ifdef EAPI
# undef EAPI
#endif /* EAPI */

#ifdef _WIN32
# ifdef EFL_EVIL_BUILD
#  ifdef DLL_EXPORT
#   define EAPI __declspec(dllexport)
#  else
#   define EAPI
#  endif /* ! DLL_EXPORT */
# else
#  define EAPI __declspec(dllimport)
# endif /* ! EFL_EVIL_BUILD */
#endif /* _WIN32 */


/**
 * @file dirent.h
 * @brief The file that provides functions ported from Unix in dirent.h.
 * @defgroup Evil_Dirent_Group Dirent.h functions
 * @ingroup Evil
 *
 * This header provides functions ported from Unix in dirent.h.
 *
 * @{
 */


#ifdef UNICODE
# include <wchar.h>
#endif

/**
 * @def DT_UNKNOWN
 * Specifies that the file type is unknown.
 */
#define DT_UNKNOWN 0

/**
 * @def DT_DIR
 * Specifies that the file type is a directory.
 */
#define DT_DIR     4

/**
 * @typedef DIR
 * @brief A structure that describes a directory stream.
 */
typedef struct DIR DIR;

/**
 * @struct dirent
 * @brief A structure that describes a directory stream.
 */
struct dirent
{
   char          d_name[260 + 1]; /**< The filename. */
   int           d_mode;          /**< The mode */
   unsigned char d_type;          /**< The type */
};


#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


/**
 * @brief Open the given directory.
 *
 * @param name The directory to open.
 * @return A pointer to the directory stream.
 *
 * This function opens the directory @p name and return the directory
 * stream. On error or if @p dir is NULL, -1 is returned, and errno is
 * set appropriately (on Windows XP only). On success, 0 is returned.
 *
 * @see closedir()
 * @see readdir()
 *
 * Conformity: None.
 *
 * Supported OS: Windows XP, CE.
 */
EAPI DIR *opendir(char const *name);

/**
 * @brief Close the given directory.
 *
 * @param dir The directory stream to close.
 * @return A pointer to the directory stream.
 *
 * This function closes the stream directory @p dir. On error or is
 * @p path is NULL or an empty string, NULL is returned, and errno is set
 * appropriately (on Windows XP only).
 *
 * @see opendir()
 * @see readdir()
 *
 * Conformity: None.
 *
 * Supported OS: Windows XP, CE.
 */
EAPI int closedir(DIR *dir);

/**
 * @brief Read the given directory.
 *
 * @param dir The directory stream to read.
 * @return A pointer to a dirent structure, @c NULL oterhwise.
 *
 * This function returns a pointer to a dirent structure representing
 * the next directory entry in the directory stream pointed to by
 * @p dir. It returns NULL on reaching the end of the directory stream
 * or if an error occurred and errno is set appropriately (on Windows XP only).
 *
 * @see opendir()
 * @see readdir()
 *
 * Conformity: None.
 *
 * Supported OS: Windows XP, CE.
 */
EAPI struct dirent *readdir(DIR *dir);


#ifdef __cplusplus
}
#endif /* __cplusplus */


#undef EAPI
#define EAPI



/**
 * @}
 */


#endif /* __EVIL_DIRENT_H__ */