xref: /netbsd-src/external/gpl2/gmake/dist/glob/fnmatch.h (revision 69606e3f5c9388e52aed8c120ad63c049ca45d8f)
1*69606e3fSchristos /* Copyright (C) 1991, 92, 93, 96, 97, 98, 99 Free Software Foundation, Inc.
2*69606e3fSchristos This file is part of the GNU C Library.
3*69606e3fSchristos 
4*69606e3fSchristos The GNU C Library is free software; you can redistribute it and/or
5*69606e3fSchristos modify it under the terms of the GNU Library General Public License as
6*69606e3fSchristos published by the Free Software Foundation; either version 2 of the
7*69606e3fSchristos License, or (at your option) any later version.
8*69606e3fSchristos 
9*69606e3fSchristos The GNU C Library is distributed in the hope that it will be useful,
10*69606e3fSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of
11*69606e3fSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12*69606e3fSchristos Library General Public License for more details.
13*69606e3fSchristos 
14*69606e3fSchristos You should have received a copy of the GNU Library General Public License
15*69606e3fSchristos along with this library; see the file COPYING.LIB.  If not, write to the Free
16*69606e3fSchristos Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
17*69606e3fSchristos USA.  */
18*69606e3fSchristos 
19*69606e3fSchristos #ifndef	_FNMATCH_H
20*69606e3fSchristos #define	_FNMATCH_H	1
21*69606e3fSchristos 
22*69606e3fSchristos #ifdef	__cplusplus
23*69606e3fSchristos extern "C" {
24*69606e3fSchristos #endif
25*69606e3fSchristos 
26*69606e3fSchristos #if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
27*69606e3fSchristos # if !defined __GLIBC__
28*69606e3fSchristos #  undef	__P
29*69606e3fSchristos #  define __P(protos)	protos
30*69606e3fSchristos # endif
31*69606e3fSchristos #else /* Not C++ or ANSI C.  */
32*69606e3fSchristos # undef	__P
33*69606e3fSchristos # define __P(protos)	()
34*69606e3fSchristos /* We can get away without defining `const' here only because in this file
35*69606e3fSchristos    it is used only inside the prototype for `fnmatch', which is elided in
36*69606e3fSchristos    non-ANSI C where `const' is problematical.  */
37*69606e3fSchristos #endif /* C++ or ANSI C.  */
38*69606e3fSchristos 
39*69606e3fSchristos #ifndef const
40*69606e3fSchristos # if (defined __STDC__ && __STDC__) || defined __cplusplus || defined WINDOWS32
41*69606e3fSchristos #  define __const	const
42*69606e3fSchristos # else
43*69606e3fSchristos #  define __const
44*69606e3fSchristos # endif
45*69606e3fSchristos #endif
46*69606e3fSchristos 
47*69606e3fSchristos /* We #undef these before defining them because some losing systems
48*69606e3fSchristos    (HP-UX A.08.07 for example) define these in <unistd.h>.  */
49*69606e3fSchristos #undef	FNM_PATHNAME
50*69606e3fSchristos #undef	FNM_NOESCAPE
51*69606e3fSchristos #undef	FNM_PERIOD
52*69606e3fSchristos 
53*69606e3fSchristos /* Bits set in the FLAGS argument to `fnmatch'.  */
54*69606e3fSchristos #define	FNM_PATHNAME	(1 << 0) /* No wildcard can ever match `/'.  */
55*69606e3fSchristos #define	FNM_NOESCAPE	(1 << 1) /* Backslashes don't quote special chars.  */
56*69606e3fSchristos #define	FNM_PERIOD	(1 << 2) /* Leading `.' is matched only explicitly.  */
57*69606e3fSchristos 
58*69606e3fSchristos #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
59*69606e3fSchristos # define FNM_FILE_NAME	 FNM_PATHNAME	/* Preferred GNU name.  */
60*69606e3fSchristos # define FNM_LEADING_DIR (1 << 3)	/* Ignore `/...' after a match.  */
61*69606e3fSchristos # define FNM_CASEFOLD	 (1 << 4)	/* Compare without regard to case.  */
62*69606e3fSchristos #endif
63*69606e3fSchristos 
64*69606e3fSchristos /* Value returned by `fnmatch' if STRING does not match PATTERN.  */
65*69606e3fSchristos #define	FNM_NOMATCH	1
66*69606e3fSchristos 
67*69606e3fSchristos /* This value is returned if the implementation does not support
68*69606e3fSchristos    `fnmatch'.  Since this is not the case here it will never be
69*69606e3fSchristos    returned but the conformance test suites still require the symbol
70*69606e3fSchristos    to be defined.  */
71*69606e3fSchristos #ifdef _XOPEN_SOURCE
72*69606e3fSchristos # define FNM_NOSYS	(-1)
73*69606e3fSchristos #endif
74*69606e3fSchristos 
75*69606e3fSchristos /* Match NAME against the filename pattern PATTERN,
76*69606e3fSchristos    returning zero if it matches, FNM_NOMATCH if not.  */
77*69606e3fSchristos extern int fnmatch __P ((__const char *__pattern, __const char *__name,
78*69606e3fSchristos 			 int __flags));
79*69606e3fSchristos 
80*69606e3fSchristos #ifdef	__cplusplus
81*69606e3fSchristos }
82*69606e3fSchristos #endif
83*69606e3fSchristos 
84*69606e3fSchristos #endif /* fnmatch.h */
85