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