xref: /netbsd-src/external/gpl2/xcvs/dist/lib/fnmatch_.h (revision a7c918477dd5f12c1da816ba05caf44eab2d06d6)
1*a7c91847Schristos /* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003,
2*a7c91847Schristos    2005 Free Software Foundation, Inc.
3*a7c91847Schristos 
4*a7c91847Schristos    This program is free software; you can redistribute it and/or modify
5*a7c91847Schristos    it under the terms of the GNU General Public License as published by
6*a7c91847Schristos    the Free Software Foundation; either version 2, or (at your option)
7*a7c91847Schristos    any later version.
8*a7c91847Schristos 
9*a7c91847Schristos    This program is distributed in the hope that it will be useful,
10*a7c91847Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*a7c91847Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*a7c91847Schristos    GNU General Public License for more details.
13*a7c91847Schristos 
14*a7c91847Schristos    You should have received a copy of the GNU General Public License
15*a7c91847Schristos    along with this program; if not, write to the Free Software Foundation,
16*a7c91847Schristos    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17*a7c91847Schristos 
18*a7c91847Schristos #ifndef	_FNMATCH_H
19*a7c91847Schristos # define _FNMATCH_H	1
20*a7c91847Schristos 
21*a7c91847Schristos # ifdef	__cplusplus
22*a7c91847Schristos extern "C" {
23*a7c91847Schristos # endif
24*a7c91847Schristos 
25*a7c91847Schristos /* We #undef these before defining them because some losing systems
26*a7c91847Schristos    (HP-UX A.08.07 for example) define these in <unistd.h>.  */
27*a7c91847Schristos # undef	FNM_PATHNAME
28*a7c91847Schristos # undef	FNM_NOESCAPE
29*a7c91847Schristos # undef	FNM_PERIOD
30*a7c91847Schristos 
31*a7c91847Schristos /* Bits set in the FLAGS argument to `fnmatch'.  */
32*a7c91847Schristos # define FNM_PATHNAME	(1 << 0) /* No wildcard can ever match `/'.  */
33*a7c91847Schristos # define FNM_NOESCAPE	(1 << 1) /* Backslashes don't quote special chars.  */
34*a7c91847Schristos # define FNM_PERIOD	(1 << 2) /* Leading `.' is matched only explicitly.  */
35*a7c91847Schristos 
36*a7c91847Schristos # if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
37*a7c91847Schristos #  define FNM_FILE_NAME	 FNM_PATHNAME	/* Preferred GNU name.  */
38*a7c91847Schristos #  define FNM_LEADING_DIR (1 << 3)	/* Ignore `/...' after a match.  */
39*a7c91847Schristos #  define FNM_CASEFOLD	 (1 << 4)	/* Compare without regard to case.  */
40*a7c91847Schristos #  define FNM_EXTMATCH	 (1 << 5)	/* Use ksh-like extended matching. */
41*a7c91847Schristos # endif
42*a7c91847Schristos 
43*a7c91847Schristos /* Value returned by `fnmatch' if STRING does not match PATTERN.  */
44*a7c91847Schristos # define FNM_NOMATCH	1
45*a7c91847Schristos 
46*a7c91847Schristos /* This value is returned if the implementation does not support
47*a7c91847Schristos    `fnmatch'.  Since this is not the case here it will never be
48*a7c91847Schristos    returned but the conformance test suites still require the symbol
49*a7c91847Schristos    to be defined.  */
50*a7c91847Schristos # ifdef _XOPEN_SOURCE
51*a7c91847Schristos #  define FNM_NOSYS	(-1)
52*a7c91847Schristos # endif
53*a7c91847Schristos 
54*a7c91847Schristos /* Match NAME against the file name pattern PATTERN,
55*a7c91847Schristos    returning zero if it matches, FNM_NOMATCH if not.  */
56*a7c91847Schristos extern int fnmatch (const char *__pattern, const char *__name,
57*a7c91847Schristos 		    int __flags);
58*a7c91847Schristos 
59*a7c91847Schristos # ifdef	__cplusplus
60*a7c91847Schristos }
61*a7c91847Schristos # endif
62*a7c91847Schristos 
63*a7c91847Schristos #endif /* fnmatch.h */
64