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