xref: /netbsd-src/external/gpl3/gdb/dist/include/fnmatch.h (revision e663ba6e3a60083e70de702e9d54bf486a57b6a7)
1*e663ba6eSchristos /* Copyright (C) 1991-2024 Free Software Foundation, Inc.
298b9484cSchristos 
398b9484cSchristos NOTE: The canonical source of this file is maintained with the GNU C Library.
498b9484cSchristos Bugs can be reported to bug-glibc@prep.ai.mit.edu.
598b9484cSchristos 
698b9484cSchristos This program is free software; you can redistribute it and/or modify it
798b9484cSchristos under the terms of the GNU General Public License as published by the
898b9484cSchristos Free Software Foundation; either version 2, or (at your option) any
998b9484cSchristos later version.
1098b9484cSchristos 
1198b9484cSchristos This program is distributed in the hope that it will be useful,
1298b9484cSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of
1398b9484cSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1498b9484cSchristos GNU General Public License for more details.
1598b9484cSchristos 
1698b9484cSchristos You should have received a copy of the GNU General Public License
1798b9484cSchristos along with this program; if not, write to the Free Software
1898b9484cSchristos Foundation, 51 Franklin Street - Fifth Floor,
1998b9484cSchristos Boston, MA 02110-1301, USA.  */
2098b9484cSchristos 
2198b9484cSchristos #ifndef	_FNMATCH_H
2298b9484cSchristos 
2398b9484cSchristos #define	_FNMATCH_H	1
2498b9484cSchristos 
2598b9484cSchristos #ifdef	__cplusplus
2698b9484cSchristos extern "C" {
2798b9484cSchristos #endif
2898b9484cSchristos 
2998b9484cSchristos #if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
3098b9484cSchristos #undef	__P
3198b9484cSchristos #define	__P(args)	args
3298b9484cSchristos #else /* Not C++ or ANSI C.  */
3398b9484cSchristos #undef	__P
3498b9484cSchristos #define	__P(args)	()
3598b9484cSchristos /* We can get away without defining `const' here only because in this file
3698b9484cSchristos    it is used only inside the prototype for `fnmatch', which is elided in
3798b9484cSchristos    non-ANSI C where `const' is problematical.  */
3898b9484cSchristos #endif /* C++ or ANSI C.  */
3998b9484cSchristos 
4098b9484cSchristos 
4198b9484cSchristos /* We #undef these before defining them because some losing systems
4298b9484cSchristos    (HP-UX A.08.07 for example) define these in <unistd.h>.  */
4398b9484cSchristos #undef	FNM_PATHNAME
4498b9484cSchristos #undef	FNM_NOESCAPE
4598b9484cSchristos #undef	FNM_PERIOD
4698b9484cSchristos 
4798b9484cSchristos /* Bits set in the FLAGS argument to `fnmatch'.  */
4898b9484cSchristos #define	FNM_PATHNAME	(1 << 0) /* No wildcard can ever match `/'.  */
4998b9484cSchristos #define	FNM_NOESCAPE	(1 << 1) /* Backslashes don't quote special chars.  */
5098b9484cSchristos #define	FNM_PERIOD	(1 << 2) /* Leading `.' is matched only explicitly.  */
5198b9484cSchristos 
5298b9484cSchristos #if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
5398b9484cSchristos #define	FNM_FILE_NAME	FNM_PATHNAME /* Preferred GNU name.  */
5498b9484cSchristos #define	FNM_LEADING_DIR	(1 << 3) /* Ignore `/...' after a match.  */
5598b9484cSchristos #define	FNM_CASEFOLD	(1 << 4) /* Compare without regard to case.  */
5698b9484cSchristos #endif
5798b9484cSchristos 
5898b9484cSchristos /* Value returned by `fnmatch' if STRING does not match PATTERN.  */
5998b9484cSchristos #define	FNM_NOMATCH	1
6098b9484cSchristos 
6198b9484cSchristos /* Match STRING against the filename pattern PATTERN,
6298b9484cSchristos    returning zero if it matches, FNM_NOMATCH if not.  */
6398b9484cSchristos extern int fnmatch __P ((const char *__pattern, const char *__string,
6498b9484cSchristos 			 int __flags));
6598b9484cSchristos 
6698b9484cSchristos #ifdef	__cplusplus
6798b9484cSchristos }
6898b9484cSchristos #endif
6998b9484cSchristos 
7098b9484cSchristos #endif /* fnmatch.h */
71