xref: /dflybsd-src/contrib/binutils-2.27/include/fnmatch.h (revision e656dc90e3d65d744d534af2f5ea88cf8101ebcf)
1*a9fa9459Szrj /* Copyright (C) 1991-2016 Free Software Foundation, Inc.
2*a9fa9459Szrj 
3*a9fa9459Szrj NOTE: The canonical source of this file is maintained with the GNU C Library.
4*a9fa9459Szrj Bugs can be reported to bug-glibc@prep.ai.mit.edu.
5*a9fa9459Szrj 
6*a9fa9459Szrj This program is free software; you can redistribute it and/or modify it
7*a9fa9459Szrj under the terms of the GNU General Public License as published by the
8*a9fa9459Szrj Free Software Foundation; either version 2, or (at your option) any
9*a9fa9459Szrj later version.
10*a9fa9459Szrj 
11*a9fa9459Szrj This program is distributed in the hope that it will be useful,
12*a9fa9459Szrj but WITHOUT ANY WARRANTY; without even the implied warranty of
13*a9fa9459Szrj MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*a9fa9459Szrj GNU General Public License for more details.
15*a9fa9459Szrj 
16*a9fa9459Szrj You should have received a copy of the GNU General Public License
17*a9fa9459Szrj along with this program; if not, write to the Free Software
18*a9fa9459Szrj Foundation, 51 Franklin Street - Fifth Floor,
19*a9fa9459Szrj Boston, MA 02110-1301, USA.  */
20*a9fa9459Szrj 
21*a9fa9459Szrj #ifndef	_FNMATCH_H
22*a9fa9459Szrj 
23*a9fa9459Szrj #define	_FNMATCH_H	1
24*a9fa9459Szrj 
25*a9fa9459Szrj #ifdef	__cplusplus
26*a9fa9459Szrj extern "C" {
27*a9fa9459Szrj #endif
28*a9fa9459Szrj 
29*a9fa9459Szrj #if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
30*a9fa9459Szrj #undef	__P
31*a9fa9459Szrj #define	__P(args)	args
32*a9fa9459Szrj #else /* Not C++ or ANSI C.  */
33*a9fa9459Szrj #undef	__P
34*a9fa9459Szrj #define	__P(args)	()
35*a9fa9459Szrj /* We can get away without defining `const' here only because in this file
36*a9fa9459Szrj    it is used only inside the prototype for `fnmatch', which is elided in
37*a9fa9459Szrj    non-ANSI C where `const' is problematical.  */
38*a9fa9459Szrj #endif /* C++ or ANSI C.  */
39*a9fa9459Szrj 
40*a9fa9459Szrj 
41*a9fa9459Szrj /* We #undef these before defining them because some losing systems
42*a9fa9459Szrj    (HP-UX A.08.07 for example) define these in <unistd.h>.  */
43*a9fa9459Szrj #undef	FNM_PATHNAME
44*a9fa9459Szrj #undef	FNM_NOESCAPE
45*a9fa9459Szrj #undef	FNM_PERIOD
46*a9fa9459Szrj 
47*a9fa9459Szrj /* Bits set in the FLAGS argument to `fnmatch'.  */
48*a9fa9459Szrj #define	FNM_PATHNAME	(1 << 0) /* No wildcard can ever match `/'.  */
49*a9fa9459Szrj #define	FNM_NOESCAPE	(1 << 1) /* Backslashes don't quote special chars.  */
50*a9fa9459Szrj #define	FNM_PERIOD	(1 << 2) /* Leading `.' is matched only explicitly.  */
51*a9fa9459Szrj 
52*a9fa9459Szrj #if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
53*a9fa9459Szrj #define	FNM_FILE_NAME	FNM_PATHNAME /* Preferred GNU name.  */
54*a9fa9459Szrj #define	FNM_LEADING_DIR	(1 << 3) /* Ignore `/...' after a match.  */
55*a9fa9459Szrj #define	FNM_CASEFOLD	(1 << 4) /* Compare without regard to case.  */
56*a9fa9459Szrj #endif
57*a9fa9459Szrj 
58*a9fa9459Szrj /* Value returned by `fnmatch' if STRING does not match PATTERN.  */
59*a9fa9459Szrj #define	FNM_NOMATCH	1
60*a9fa9459Szrj 
61*a9fa9459Szrj /* Match STRING against the filename pattern PATTERN,
62*a9fa9459Szrj    returning zero if it matches, FNM_NOMATCH if not.  */
63*a9fa9459Szrj extern int fnmatch __P ((const char *__pattern, const char *__string,
64*a9fa9459Szrj 			 int __flags));
65*a9fa9459Szrj 
66*a9fa9459Szrj #ifdef	__cplusplus
67*a9fa9459Szrj }
68*a9fa9459Szrj #endif
69*a9fa9459Szrj 
70*a9fa9459Szrj #endif /* fnmatch.h */
71