summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2021-05-03 16:26:38 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-05-03 16:26:38 +0100
commit3d374692f7dcdea4e7fb18b77ecf32d39fb367db (patch)
tree1fe3627ad306540a40e5933b1bd0bdac188e0d8e /src
parentf7449d802c69ae339e0d766b398e27492bc2675d (diff)
Eina: API addition: interface musl's fnmatch() implementation
Summary: addd musl's fnmatch() implementation to Eina Test Plan: compilation and simple test case Reviewers: raster Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12261
Diffstat (limited to 'src')
-rw-r--r--src/lib/eina/Eina.h1
-rw-r--r--src/lib/eina/eina_fnmatch.c47
-rw-r--r--src/lib/eina/eina_fnmatch.h34
-rw-r--r--src/lib/eina/meson.build2
-rw-r--r--src/static_libs/fnmatch/COPYRIGHT193
-rw-r--r--src/static_libs/fnmatch/fnmatch.c325
-rw-r--r--src/static_libs/fnmatch/fnmatch.h28
7 files changed, 630 insertions, 0 deletions
diff --git a/src/lib/eina/Eina.h b/src/lib/eina/Eina.h
index d2ce89e805..da73953362 100644
--- a/src/lib/eina/Eina.h
+++ b/src/lib/eina/Eina.h
@@ -214,6 +214,7 @@ extern "C" {
214#include <eina_types.h> 214#include <eina_types.h>
215#include <eina_alloca.h> 215#include <eina_alloca.h>
216#include <eina_main.h> 216#include <eina_main.h>
217#include <eina_fnmatch.h>
217#include <eina_fp.h> 218#include <eina_fp.h>
218#include <eina_rectangle.h> 219#include <eina_rectangle.h>
219#include <eina_range.h> 220#include <eina_range.h>
diff --git a/src/lib/eina/eina_fnmatch.c b/src/lib/eina/eina_fnmatch.c
new file mode 100644
index 0000000000..697a06edb0
--- /dev/null
+++ b/src/lib/eina/eina_fnmatch.c
@@ -0,0 +1,47 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2012 Rich Felker
3 * Copyright (C) 2021 Vincent Torri
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library;
17 * if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <string.h>
21#include <stdlib.h>
22#include <wchar.h>
23#include <wctype.h>
24
25#include "eina_config.h"
26#include "eina_private.h"
27#include "eina_fnmatch.h"
28#include "../../static_libs/fnmatch/fnmatch.h"
29#include "../../static_libs/fnmatch/fnmatch.c"
30
31/*============================================================================*
32 * Local *
33 *============================================================================*/
34
35/*============================================================================*
36 * Global *
37 *============================================================================*/
38
39/*============================================================================*
40 * API *
41 *============================================================================*/
42
43EINA_API Eina_Bool
44eina_fnmatch(const char *glob, const char *string, Eina_Fnmatch_Flags flags)
45{
46 return (__fnmatch(glob, string, flags) == 0);
47}
diff --git a/src/lib/eina/eina_fnmatch.h b/src/lib/eina/eina_fnmatch.h
new file mode 100644
index 0000000000..2cb16ff7f1
--- /dev/null
+++ b/src/lib/eina/eina_fnmatch.h
@@ -0,0 +1,34 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2021 Vincent Torri
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef EINA_FNMATCH_H
20#define EINA_FNMATCH_H
21
22typedef enum
23{
24 EINA_FNMATCH_PATHNAME = (1 << 0),
25 EINA_FNMATCH_NOESCAPE = (1 << 1),
26 EINA_FNMATCH_PERIOD = (1 << 2),
27 EINA_FNMATCH_LEADING_DIR = (1 << 3),
28 EINA_FNMATCH_CASEFOLD = (1 << 4),
29 EINA_FNMATCH_FILE_NAME = EINA_FNMATCH_PATHNAME,
30} Eina_Fnmatch_Flags;
31
32EINA_API Eina_Bool eina_fnmatch(const char *glob, const char *string, Eina_Fnmatch_Flags flags);
33
34#endif
diff --git a/src/lib/eina/meson.build b/src/lib/eina/meson.build
index afe945d754..f611bf4c5a 100644
--- a/src/lib/eina/meson.build
+++ b/src/lib/eina/meson.build
@@ -19,6 +19,7 @@ public_sub_headers = [
19'eina_debug_private.h', 19'eina_debug_private.h',
20'eina_log.h', 20'eina_log.h',
21'eina_inline_log.x', 21'eina_inline_log.x',
22'eina_fnmatch.h',
22'eina_fp.h', 23'eina_fp.h',
23'eina_inline_f32p32.x', 24'eina_inline_f32p32.x',
24'eina_inline_f16p16.x', 25'eina_inline_f16p16.x',
@@ -142,6 +143,7 @@ eina_src = files([
142'eina_evlog.c', 143'eina_evlog.c',
143'eina_file_common.h', 144'eina_file_common.h',
144'eina_file_common.c', 145'eina_file_common.c',
146'eina_fnmatch.c',
145'eina_fp.c', 147'eina_fp.c',
146'eina_hamster.c', 148'eina_hamster.c',
147'eina_hash.c', 149'eina_hash.c',
diff --git a/src/static_libs/fnmatch/COPYRIGHT b/src/static_libs/fnmatch/COPYRIGHT
new file mode 100644
index 0000000000..c1628e9ac8
--- /dev/null
+++ b/src/static_libs/fnmatch/COPYRIGHT
@@ -0,0 +1,193 @@
1musl as a whole is licensed under the following standard MIT license:
2
3----------------------------------------------------------------------
4Copyright © 2005-2020 Rich Felker, et al.
5
6Permission is hereby granted, free of charge, to any person obtaining
7a copy of this software and associated documentation files (the
8"Software"), to deal in the Software without restriction, including
9without limitation the rights to use, copy, modify, merge, publish,
10distribute, sublicense, and/or sell copies of the Software, and to
11permit persons to whom the Software is furnished to do so, subject to
12the following conditions:
13
14The above copyright notice and this permission notice shall be
15included in all copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24----------------------------------------------------------------------
25
26Authors/contributors include:
27
28A. Wilcox
29Ada Worcester
30Alex Dowad
31Alex Suykov
32Alexander Monakov
33Andre McCurdy
34Andrew Kelley
35Anthony G. Basile
36Aric Belsito
37Arvid Picciani
38Bartosz Brachaczek
39Benjamin Peterson
40Bobby Bingham
41Boris Brezillon
42Brent Cook
43Chris Spiegel
44Clément Vasseur
45Daniel Micay
46Daniel Sabogal
47Daurnimator
48David Carlier
49David Edelsohn
50Denys Vlasenko
51Dmitry Ivanov
52Dmitry V. Levin
53Drew DeVault
54Emil Renner Berthing
55Fangrui Song
56Felix Fietkau
57Felix Janda
58Gianluca Anzolin
59Hauke Mehrtens
60He X
61Hiltjo Posthuma
62Isaac Dunham
63Jaydeep Patil
64Jens Gustedt
65Jeremy Huntwork
66Jo-Philipp Wich
67Joakim Sindholt
68John Spencer
69Julien Ramseier
70Justin Cormack
71Kaarle Ritvanen
72Khem Raj
73Kylie McClain
74Leah Neukirchen
75Luca Barbato
76Luka Perkov
77M Farkas-Dyck (Strake)
78Mahesh Bodapati
79Markus Wichmann
80Masanori Ogino
81Michael Clark
82Michael Forney
83Mikhail Kremnyov
84Natanael Copa
85Nicholas J. Kain
86orc
87Pascal Cuoq
88Patrick Oppenlander
89Petr Hosek
90Petr Skocik
91Pierre Carrier
92Reini Urban
93Rich Felker
94Richard Pennington
95Ryan Fairfax
96Samuel Holland
97Segev Finer
98Shiz
99sin
100Solar Designer
101Stefan Kristiansson
102Stefan O'Rear
103Szabolcs Nagy
104Timo Teräs
105Trutz Behn
106Valentin Ochs
107Will Dietz
108William Haddon
109William Pitcock
110
111Portions of this software are derived from third-party works licensed
112under terms compatible with the above MIT license:
113
114The TRE regular expression implementation (src/regex/reg* and
115src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
116under a 2-clause BSD license (license text in the source files). The
117included version has been heavily modified by Rich Felker in 2012, in
118the interests of size, simplicity, and namespace cleanliness.
119
120Much of the math library code (src/math/* and src/complex/*) is
121Copyright © 1993,2004 Sun Microsystems or
122Copyright © 2003-2011 David Schultz or
123Copyright © 2003-2009 Steven G. Kargl or
124Copyright © 2003-2009 Bruce D. Evans or
125Copyright © 2008 Stephen L. Moshier or
126Copyright © 2017-2018 Arm Limited
127and labelled as such in comments in the individual source files. All
128have been licensed under extremely permissive terms.
129
130The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
131The Android Open Source Project and is licensed under a two-clause BSD
132license. It was taken from Bionic libc, used on Android.
133
134The AArch64 memcpy and memset code (src/string/aarch64/*) are
135Copyright © 1999-2019, Arm Limited.
136
137The implementation of DES for crypt (src/crypt/crypt_des.c) is
138Copyright © 1994 David Burren. It is licensed under a BSD license.
139
140The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was
141originally written by Solar Designer and placed into the public
142domain. The code also comes with a fallback permissive license for use
143in jurisdictions that may not recognize the public domain.
144
145The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
146Valentin Ochs and is licensed under an MIT-style license.
147
148The x86_64 port was written by Nicholas J. Kain and is licensed under
149the standard MIT terms.
150
151The mips and microblaze ports were originally written by Richard
152Pennington for use in the ellcc project. The original code was adapted
153by Rich Felker for build system and code conventions during upstream
154integration. It is licensed under the standard MIT terms.
155
156The mips64 port was contributed by Imagination Technologies and is
157licensed under the standard MIT terms.
158
159The powerpc port was also originally written by Richard Pennington,
160and later supplemented and integrated by John Spencer. It is licensed
161under the standard MIT terms.
162
163All other files which have no copyright comments are original works
164produced specifically for use as part of this library, written either
165by Rich Felker, the main author of the library, or by one or more
166contibutors listed above. Details on authorship of individual files
167can be found in the git version control history of the project. The
168omission of copyright and license comments in each file is in the
169interest of source tree size.
170
171In addition, permission is hereby granted for all public header files
172(include/* and arch/*/bits/*) and crt files intended to be linked into
173applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit
174the copyright notice and permission notice otherwise required by the
175license, and to use these files without any requirement of
176attribution. These files include substantial contributions from:
177
178Bobby Bingham
179John Spencer
180Nicholas J. Kain
181Rich Felker
182Richard Pennington
183Stefan Kristiansson
184Szabolcs Nagy
185
186all of whom have explicitly granted such permission.
187
188This file previously contained text expressing a belief that most of
189the files covered by the above exception were sufficiently trivial not
190to be subject to copyright, resulting in confusion over whether it
191negated the permissions granted in the license. In the spirit of
192permissive licensing, and of not having licensing issues being an
193obstacle to adoption, that text has been removed.
diff --git a/src/static_libs/fnmatch/fnmatch.c b/src/static_libs/fnmatch/fnmatch.c
new file mode 100644
index 0000000000..089ccb5cbf
--- /dev/null
+++ b/src/static_libs/fnmatch/fnmatch.c
@@ -0,0 +1,325 @@
1/*
2 * LICENSE: MIT, see COPYRIGHT file in the directory
3 */
4
5/*
6 * An implementation of what I call the "Sea of Stars" algorithm for
7 * POSIX fnmatch(). The basic idea is that we factor the pattern into
8 * a head component (which we match first and can reject without ever
9 * measuring the length of the string), an optional tail component
10 * (which only exists if the pattern contains at least one star), and
11 * an optional "sea of stars", a set of star-separated components
12 * between the head and tail. After the head and tail matches have
13 * been removed from the input string, the components in the "sea of
14 * stars" are matched sequentially by searching for their first
15 * occurrence past the end of the previous match.
16 *
17 * - Rich Felker, April 2012
18 */
19
20#include <string.h>
21#include "fnmatch.h"
22#include <stdlib.h>
23#include <wchar.h>
24#include <wctype.h>
25/* #include "locale_impl.h" */
26
27#define END 0
28#define UNMATCHABLE -2
29#define BRACKET -3
30#define QUESTION -4
31#define STAR -5
32
33static int str_next(const char *str, size_t n, size_t *step)
34{
35 if (!n) {
36 *step = 0;
37 return 0;
38 }
39 if (str[0] >= 128U) {
40 wchar_t wc;
41 int k = mbtowc(&wc, str, n);
42 if (k<0) {
43 *step = 1;
44 return -1;
45 }
46 *step = k;
47 return wc;
48 }
49 *step = 1;
50 return str[0];
51}
52
53static int pat_next(const char *pat, size_t m, size_t *step, int flags)
54{
55 int esc = 0;
56 if (!m || !*pat) {
57 *step = 0;
58 return END;
59 }
60 *step = 1;
61 if (pat[0]=='\\' && pat[1] && !(flags & __FNM_NOESCAPE)) {
62 *step = 2;
63 pat++;
64 esc = 1;
65 goto escaped;
66 }
67 if (pat[0]=='[') {
68 size_t k = 1;
69 if (k<m) if (pat[k] == '^' || pat[k] == '!') k++;
70 if (k<m) if (pat[k] == ']') k++;
71 for (; k<m && pat[k] && pat[k]!=']'; k++) {
72 if (k+1<m && pat[k+1] && pat[k]=='[' && (pat[k+1]==':' || pat[k+1]=='.' || pat[k+1]=='=')) {
73 int z = pat[k+1];
74 k+=2;
75 if (k<m && pat[k]) k++;
76 while (k<m && pat[k] && (pat[k-1]!=z || pat[k]!=']')) k++;
77 if (k==m || !pat[k]) break;
78 }
79 }
80 if (k==m || !pat[k]) {
81 *step = 1;
82 return '[';
83 }
84 *step = k+1;
85 return BRACKET;
86 }
87 if (pat[0] == '*')
88 return STAR;
89 if (pat[0] == '?')
90 return QUESTION;
91escaped:
92 if (pat[0] >= 128U) {
93 wchar_t wc;
94 int k = mbtowc(&wc, pat, m);
95 if (k<0) {
96 *step = 0;
97 return UNMATCHABLE;
98 }
99 *step = k + esc;
100 return wc;
101 }
102 return pat[0];
103}
104
105static int casefold(int k)
106{
107 int c = towupper(k);
108 return c == k ? towlower(k) : c;
109}
110
111static int match_bracket(const char *p, int k, int kfold)
112{
113 wchar_t wc;
114 int inv = 0;
115 p++;
116 if (*p=='^' || *p=='!') {
117 inv = 1;
118 p++;
119 }
120 if (*p==']') {
121 if (k==']') return !inv;
122 p++;
123 } else if (*p=='-') {
124 if (k=='-') return !inv;
125 p++;
126 }
127 wc = p[-1];
128 for (; *p != ']'; p++) {
129 if (p[0]=='-' && p[1]!=']') {
130 wchar_t wc2;
131 int l = mbtowc(&wc2, p+1, 4);
132 if (l < 0) return 0;
133 if (wc <= wc2)
134 if ((unsigned)k-wc <= wc2-wc ||
135 (unsigned)kfold-wc <= wc2-wc)
136 return !inv;
137 p += l-1;
138 continue;
139 }
140 if (p[0]=='[' && (p[1]==':' || p[1]=='.' || p[1]=='=')) {
141 const char *p0 = p+2;
142 int z = p[1];
143 p+=3;
144 while (p[-1]!=z || p[0]!=']') p++;
145 if (z == ':' && p-1-p0 < 16) {
146 char buf[16];
147 memcpy(buf, p0, p-1-p0);
148 buf[p-1-p0] = 0;
149 if (iswctype(k, wctype(buf)) ||
150 iswctype(kfold, wctype(buf)))
151 return !inv;
152 }
153 continue;
154 }
155 if (*p < 128U) {
156 wc = (unsigned char)*p;
157 } else {
158 int l = mbtowc(&wc, p, 4);
159 if (l < 0) return 0;
160 p += l-1;
161 }
162 if (wc==k || wc==kfold) return !inv;
163 }
164 return inv;
165}
166
167static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n, int flags)
168{
169 const char *p, *ptail, *endpat;
170 const char *s, *stail, *endstr;
171 size_t pinc, sinc, tailcnt=0;
172 int c, k, kfold;
173
174 if (flags & __FNM_PERIOD) {
175 if (*str == '.' && *pat != '.')
176 return __FNM_NOMATCH;
177 }
178 for (;;) {
179 switch ((c = pat_next(pat, m, &pinc, flags))) {
180 case UNMATCHABLE:
181 return __FNM_NOMATCH;
182 case STAR:
183 pat++;
184 m--;
185 break;
186 default:
187 k = str_next(str, n, &sinc);
188 if (k <= 0)
189 return (c==END) ? 0 : __FNM_NOMATCH;
190 str += sinc;
191 n -= sinc;
192 kfold = flags & __FNM_CASEFOLD ? casefold(k) : k;
193 if (c == BRACKET) {
194 if (!match_bracket(pat, k, kfold))
195 return __FNM_NOMATCH;
196 } else if (c != QUESTION && k != c && kfold != c) {
197 return __FNM_NOMATCH;
198 }
199 pat+=pinc;
200 m-=pinc;
201 continue;
202 }
203 break;
204 }
205
206 /* Compute real pat length if it was initially unknown/-1 */
207 m = strnlen(pat, m);
208 endpat = pat + m;
209
210 /* Find the last * in pat and count chars needed after it */
211 for (p=ptail=pat; p<endpat; p+=pinc) {
212 switch (pat_next(p, endpat-p, &pinc, flags)) {
213 case UNMATCHABLE:
214 return __FNM_NOMATCH;
215 case STAR:
216 tailcnt=0;
217 ptail = p+1;
218 break;
219 default:
220 tailcnt++;
221 break;
222 }
223 }
224
225 /* Past this point we need not check for UNMATCHABLE in pat,
226 * because all of pat has already been parsed once. */
227
228 /* Compute real str length if it was initially unknown/-1 */
229 n = strnlen(str, n);
230 endstr = str + n;
231 if (n < tailcnt) return __FNM_NOMATCH;
232
233 /* Find the final tailcnt chars of str, accounting for UTF-8.
234 * On illegal sequences we may get it wrong, but in that case
235 * we necessarily have a matching failure anyway. */
236 for (s=endstr; s>str && tailcnt; tailcnt--) {
237 if (s[-1] < 128U || MB_CUR_MAX==1) s--;
238 else while ((unsigned char)*--s-0x80U<0x40 && s>str);
239 }
240 if (tailcnt) return __FNM_NOMATCH;
241 stail = s;
242
243 /* Check that the pat and str tails match */
244 p = ptail;
245 for (;;) {
246 c = pat_next(p, endpat-p, &pinc, flags);
247 p += pinc;
248 if ((k = str_next(s, endstr-s, &sinc)) <= 0) {
249 if (c != END) return __FNM_NOMATCH;
250 break;
251 }
252 s += sinc;
253 kfold = flags & __FNM_CASEFOLD ? casefold(k) : k;
254 if (c == BRACKET) {
255 if (!match_bracket(p-pinc, k, kfold))
256 return __FNM_NOMATCH;
257 } else if (c != QUESTION && k != c && kfold != c) {
258 return __FNM_NOMATCH;
259 }
260 }
261
262 /* We're all done with the tails now, so throw them out */
263 endstr = stail;
264 endpat = ptail;
265
266 /* Match pattern components until there are none left */
267 while (pat<endpat) {
268 p = pat;
269 s = str;
270 for (;;) {
271 c = pat_next(p, endpat-p, &pinc, flags);
272 p += pinc;
273 /* Encountering * completes/commits a component */
274 if (c == STAR) {
275 pat = p;
276 str = s;
277 break;
278 }
279 k = str_next(s, endstr-s, &sinc);
280 if (!k)
281 return __FNM_NOMATCH;
282 kfold = flags & __FNM_CASEFOLD ? casefold(k) : k;
283 if (c == BRACKET) {
284 if (!match_bracket(p-pinc, k, kfold))
285 break;
286 } else if (c != QUESTION && k != c && kfold != c) {
287 break;
288 }
289 s += sinc;
290 }
291 if (c == STAR) continue;
292 /* If we failed, advance str, by 1 char if it's a valid
293 * char, or past all invalid bytes otherwise. */
294 k = str_next(str, endstr-str, &sinc);
295 if (k > 0) str += sinc;
296 else for (str++; str_next(str, endstr-str, &sinc)<0; str++);
297 }
298
299 return 0;
300}
301
302int __fnmatch(const char *pat, const char *str, int flags)
303{
304 const char *s, *p;
305 size_t inc;
306 int c;
307 if (flags & __FNM_PATHNAME) for (;;) {
308 for (s=str; *s && *s!='/'; s++);
309 for (p=pat; (c=pat_next(p, -1, &inc, flags))!=END && c!='/'; p+=inc);
310 if (c!=*s && (!*s || !(flags & __FNM_LEADING_DIR)))
311 return __FNM_NOMATCH;
312 if (fnmatch_internal(pat, p-pat, str, s-str, flags))
313 return __FNM_NOMATCH;
314 if (!c) return 0;
315 str = s+1;
316 pat = p+inc;
317 } else if (flags & __FNM_LEADING_DIR) {
318 for (s=str; *s; s++) {
319 if (*s != '/') continue;
320 if (!fnmatch_internal(pat, -1, str, s-str, flags))
321 return 0;
322 }
323 }
324 return fnmatch_internal(pat, -1, str, -1, flags);
325}
diff --git a/src/static_libs/fnmatch/fnmatch.h b/src/static_libs/fnmatch/fnmatch.h
new file mode 100644
index 0000000000..074661388b
--- /dev/null
+++ b/src/static_libs/fnmatch/fnmatch.h
@@ -0,0 +1,28 @@
1/*
2 * LICENSE: MIT, see COPYRIGHT file in the directory
3 */
4
5#ifndef _FNMATCH_H
6#define _FNMATCH_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#define __FNM_PATHNAME 0x1
13#define __FNM_NOESCAPE 0x2
14#define __FNM_PERIOD 0x4
15#define __FNM_LEADING_DIR 0x8
16#define __FNM_CASEFOLD 0x10
17#define __FNM_FILE_NAME __FNM_PATHNAME
18
19#define __FNM_NOMATCH 1
20#define __FNM_NOSYS (-1)
21
22int __fnmatch(const char *, const char *, int);
23
24#ifdef __cplusplus
25}
26#endif
27
28#endif