xref: /netbsd-src/external/gpl3/binutils.old/dist/include/fnmatch.h (revision e992f068c547fd6e84b3f104dc2340adcc955732)
1*e992f068Schristos /* Copyright (C) 1991-2022 Free Software Foundation, Inc.
275fd0b74Schristos 
375fd0b74Schristos NOTE: The canonical source of this file is maintained with the GNU C Library.
475fd0b74Schristos Bugs can be reported to bug-glibc@prep.ai.mit.edu.
575fd0b74Schristos 
675fd0b74Schristos This program is free software; you can redistribute it and/or modify it
775fd0b74Schristos under the terms of the GNU General Public License as published by the
875fd0b74Schristos Free Software Foundation; either version 2, or (at your option) any
975fd0b74Schristos later version.
1075fd0b74Schristos 
1175fd0b74Schristos This program is distributed in the hope that it will be useful,
1275fd0b74Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of
1375fd0b74Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1475fd0b74Schristos GNU General Public License for more details.
1575fd0b74Schristos 
1675fd0b74Schristos You should have received a copy of the GNU General Public License
1775fd0b74Schristos along with this program; if not, write to the Free Software
1875fd0b74Schristos Foundation, 51 Franklin Street - Fifth Floor,
1975fd0b74Schristos Boston, MA 02110-1301, USA.  */
2075fd0b74Schristos 
2175fd0b74Schristos #ifndef	_FNMATCH_H
2275fd0b74Schristos 
2375fd0b74Schristos #define	_FNMATCH_H	1
2475fd0b74Schristos 
2575fd0b74Schristos #ifdef	__cplusplus
2675fd0b74Schristos extern "C" {
2775fd0b74Schristos #endif
2875fd0b74Schristos 
2975fd0b74Schristos #if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
3075fd0b74Schristos #undef	__P
3175fd0b74Schristos #define	__P(args)	args
3275fd0b74Schristos #else /* Not C++ or ANSI C.  */
3375fd0b74Schristos #undef	__P
3475fd0b74Schristos #define	__P(args)	()
3575fd0b74Schristos /* We can get away without defining `const' here only because in this file
3675fd0b74Schristos    it is used only inside the prototype for `fnmatch', which is elided in
3775fd0b74Schristos    non-ANSI C where `const' is problematical.  */
3875fd0b74Schristos #endif /* C++ or ANSI C.  */
3975fd0b74Schristos 
4075fd0b74Schristos 
4175fd0b74Schristos /* We #undef these before defining them because some losing systems
4275fd0b74Schristos    (HP-UX A.08.07 for example) define these in <unistd.h>.  */
4375fd0b74Schristos #undef	FNM_PATHNAME
4475fd0b74Schristos #undef	FNM_NOESCAPE
4575fd0b74Schristos #undef	FNM_PERIOD
4675fd0b74Schristos 
4775fd0b74Schristos /* Bits set in the FLAGS argument to `fnmatch'.  */
4875fd0b74Schristos #define	FNM_PATHNAME	(1 << 0) /* No wildcard can ever match `/'.  */
4975fd0b74Schristos #define	FNM_NOESCAPE	(1 << 1) /* Backslashes don't quote special chars.  */
5075fd0b74Schristos #define	FNM_PERIOD	(1 << 2) /* Leading `.' is matched only explicitly.  */
5175fd0b74Schristos 
5275fd0b74Schristos #if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
5375fd0b74Schristos #define	FNM_FILE_NAME	FNM_PATHNAME /* Preferred GNU name.  */
5475fd0b74Schristos #define	FNM_LEADING_DIR	(1 << 3) /* Ignore `/...' after a match.  */
5575fd0b74Schristos #define	FNM_CASEFOLD	(1 << 4) /* Compare without regard to case.  */
5675fd0b74Schristos #endif
5775fd0b74Schristos 
5875fd0b74Schristos /* Value returned by `fnmatch' if STRING does not match PATTERN.  */
5975fd0b74Schristos #define	FNM_NOMATCH	1
6075fd0b74Schristos 
6175fd0b74Schristos /* Match STRING against the filename pattern PATTERN,
6275fd0b74Schristos    returning zero if it matches, FNM_NOMATCH if not.  */
6375fd0b74Schristos extern int fnmatch __P ((const char *__pattern, const char *__string,
6475fd0b74Schristos 			 int __flags));
6575fd0b74Schristos 
6675fd0b74Schristos #ifdef	__cplusplus
6775fd0b74Schristos }
6875fd0b74Schristos #endif
6975fd0b74Schristos 
7075fd0b74Schristos #endif /* fnmatch.h */
71