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