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
|
%% options
copyright owner = Dirk Krause
copyright year = 2015-xxxx
license = bsd
%% header
/** @file
File name expander.
CRT on Windows: Optional.
*/
#ifndef DK4CONF_H_INCLUDED
#include "dk4conf.h"
#endif
#ifndef DK4DIR_H_INCLUDED
#include "dk4dir.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/** Expand a file name.
@param pattern File name pattern, may optionally include
a directory part.
@param erp Error report, may be NULL.
@return Directory structure on success, NULL on error.
On success the path component in the returned directory structure
is NULL if the pattern did not contain a directory part.
Error codes:
- DK4_E_INVALID_ARGUMENTS<br>
if path is NULL,
- DK4_E_NOT_SUPPORTED<br>
if no function to traverse directories was found during build
process or the function is called on a non-Windows system,
- DK4_E_MEMORY_ALLOCATION_FAILED<br>
if a memory allocation failed,
- DK4_E_MATH_OVERFLOW<br>
if a mathematical overflow occured in a size calculation,
- DK4_E_BUFFER_TOO_SMALL<br>
if one of the involved directory or file names is too long for an
internal buffer,
- DK4_E_OPENDIR_FAILED<br>
with errno value in iDetails1 if the attempt to open the directory
failed,
- DK4_E_FINDFIRSTFILE_FAILED<br>
with GetLastError() value in lDetails1 if the FindFirstFile()
function failed on Windows,
- DK4_E_SYSTEM<br>
if the stat() or lstat() function failed for one of the directory
items.
*/
dk4_dir_t *
dk4fne_open(const dkChar *pattern, dk4_er_t *erp);
#ifdef __cplusplus
}
#endif
%% module
#include "dk4fne.h"
#if DK4_CHAR_SIZE > 1
#ifndef DK4FNEWC_H_INCLUDED
#include "dk4fnewc.h"
#endif
#else
#ifndef DK4FNE08_H_INCLUDED
#include "dk4fne08.h"
#endif
#endif
dk4_dir_t *
dk4fne_open(const dkChar *pattern, dk4_er_t *erp)
{
#if DK4_CHAR_SIZE > 1
return (dk4fne_open_wc(pattern, erp));
#else
return (dk4fne_open_c8(pattern, erp));
#endif
}
|