xref: /Universal-ctags/gnulib/fnmatch.in.h (revision a939078a69878851c19820eb92e6cb95ba429546)
1*a939078aSHiroo HAYASHI /* Substitute for and wrapper around <fnmatch.h>.
2*a939078aSHiroo HAYASHI    Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2021 Free
3*a939078aSHiroo HAYASHI    Software Foundation, Inc.
4*a939078aSHiroo HAYASHI 
5*a939078aSHiroo HAYASHI    This file is part of the GNU C Library.
6*a939078aSHiroo HAYASHI 
7*a939078aSHiroo HAYASHI    This file is free software: you can redistribute it and/or modify
8*a939078aSHiroo HAYASHI    it under the terms of the GNU Lesser General Public License as
9*a939078aSHiroo HAYASHI    published by the Free Software Foundation; either version 2.1 of the
10*a939078aSHiroo HAYASHI    License, or (at your option) any later version.
11*a939078aSHiroo HAYASHI 
12*a939078aSHiroo HAYASHI    This file is distributed in the hope that it will be useful,
13*a939078aSHiroo HAYASHI    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*a939078aSHiroo HAYASHI    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*a939078aSHiroo HAYASHI    GNU Lesser General Public License for more details.
16*a939078aSHiroo HAYASHI 
17*a939078aSHiroo HAYASHI    You should have received a copy of the GNU Lesser General Public License
18*a939078aSHiroo HAYASHI    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
19*a939078aSHiroo HAYASHI 
20*a939078aSHiroo HAYASHI #ifndef _@GUARD_PREFIX@_FNMATCH_H
21*a939078aSHiroo HAYASHI 
22*a939078aSHiroo HAYASHI #if __GNUC__ >= 3
23*a939078aSHiroo HAYASHI @PRAGMA_SYSTEM_HEADER@
24*a939078aSHiroo HAYASHI #endif
25*a939078aSHiroo HAYASHI @PRAGMA_COLUMNS@
26*a939078aSHiroo HAYASHI 
27*a939078aSHiroo HAYASHI /* The include_next requires a split double-inclusion guard.  */
28*a939078aSHiroo HAYASHI #if @HAVE_FNMATCH_H@ && !@REPLACE_FNMATCH@
29*a939078aSHiroo HAYASHI # @INCLUDE_NEXT@ @NEXT_FNMATCH_H@
30*a939078aSHiroo HAYASHI #endif
31*a939078aSHiroo HAYASHI 
32*a939078aSHiroo HAYASHI #ifndef _@GUARD_PREFIX@_FNMATCH_H
33*a939078aSHiroo HAYASHI #define _@GUARD_PREFIX@_FNMATCH_H
34*a939078aSHiroo HAYASHI 
35*a939078aSHiroo HAYASHI /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
36*a939078aSHiroo HAYASHI 
37*a939078aSHiroo HAYASHI /* The definition of _GL_ARG_NONNULL is copied here.  */
38*a939078aSHiroo HAYASHI 
39*a939078aSHiroo HAYASHI /* The definition of _GL_WARN_ON_USE is copied here.  */
40*a939078aSHiroo HAYASHI 
41*a939078aSHiroo HAYASHI #if !@HAVE_FNMATCH_H@ || @REPLACE_FNMATCH@
42*a939078aSHiroo HAYASHI 
43*a939078aSHiroo HAYASHI /* We #undef these before defining them because some losing systems
44*a939078aSHiroo HAYASHI    (HP-UX A.08.07 for example) define these in <unistd.h>.  */
45*a939078aSHiroo HAYASHI #undef  FNM_PATHNAME
46*a939078aSHiroo HAYASHI #undef  FNM_NOESCAPE
47*a939078aSHiroo HAYASHI #undef  FNM_PERIOD
48*a939078aSHiroo HAYASHI 
49*a939078aSHiroo HAYASHI /* Bits set in the FLAGS argument to 'fnmatch'.  */
50*a939078aSHiroo HAYASHI #define FNM_PATHNAME    (1 << 0) /* No wildcard can ever match '/'.  */
51*a939078aSHiroo HAYASHI #define FNM_NOESCAPE    (1 << 1) /* Backslashes don't quote special chars.  */
52*a939078aSHiroo HAYASHI #define FNM_PERIOD      (1 << 2) /* Leading '.' is matched only explicitly.  */
53*a939078aSHiroo HAYASHI 
54*a939078aSHiroo HAYASHI #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
55*a939078aSHiroo HAYASHI # define FNM_FILE_NAME   FNM_PATHNAME   /* Preferred GNU name.  */
56*a939078aSHiroo HAYASHI # define FNM_LEADING_DIR (1 << 3)       /* Ignore '/...' after a match.  */
57*a939078aSHiroo HAYASHI # define FNM_CASEFOLD    (1 << 4)       /* Compare without regard to case.  */
58*a939078aSHiroo HAYASHI # define FNM_EXTMATCH    (1 << 5)       /* Use ksh-like extended matching. */
59*a939078aSHiroo HAYASHI #endif
60*a939078aSHiroo HAYASHI 
61*a939078aSHiroo HAYASHI /* Value returned by 'fnmatch' if STRING does not match PATTERN.  */
62*a939078aSHiroo HAYASHI #define FNM_NOMATCH     1
63*a939078aSHiroo HAYASHI 
64*a939078aSHiroo HAYASHI /* This value is returned if the implementation does not support
65*a939078aSHiroo HAYASHI    'fnmatch'.  Since this is not the case here it will never be
66*a939078aSHiroo HAYASHI    returned but the conformance test suites still require the symbol
67*a939078aSHiroo HAYASHI    to be defined.  */
68*a939078aSHiroo HAYASHI #ifdef _XOPEN_SOURCE
69*a939078aSHiroo HAYASHI # define FNM_NOSYS      (-1)
70*a939078aSHiroo HAYASHI #endif
71*a939078aSHiroo HAYASHI 
72*a939078aSHiroo HAYASHI #endif
73*a939078aSHiroo HAYASHI 
74*a939078aSHiroo HAYASHI 
75*a939078aSHiroo HAYASHI #if @GNULIB_FNMATCH@
76*a939078aSHiroo HAYASHI /* Match NAME against the file name pattern PATTERN,
77*a939078aSHiroo HAYASHI    returning zero if it matches, FNM_NOMATCH if not.  */
78*a939078aSHiroo HAYASHI # if @REPLACE_FNMATCH@
79*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
80*a939078aSHiroo HAYASHI #   define fnmatch rpl_fnmatch
81*a939078aSHiroo HAYASHI #  endif
82*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (fnmatch, int,
83*a939078aSHiroo HAYASHI                   (const char *pattern, const char *name, int flags)
84*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 2)));
85*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (fnmatch, int,
86*a939078aSHiroo HAYASHI                   (const char *pattern, const char *name, int flags));
87*a939078aSHiroo HAYASHI # else
88*a939078aSHiroo HAYASHI #  if !@HAVE_FNMATCH@
89*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (fnmatch, int,
90*a939078aSHiroo HAYASHI                   (const char *pattern, const char *name, int flags)
91*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 2)));
92*a939078aSHiroo HAYASHI #  endif
93*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (fnmatch, int,
94*a939078aSHiroo HAYASHI                   (const char *pattern, const char *name, int flags));
95*a939078aSHiroo HAYASHI # endif
96*a939078aSHiroo HAYASHI # if !GNULIB_FNMATCH_GNU && __GLIBC__ >= 2
97*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (fnmatch);
98*a939078aSHiroo HAYASHI # endif
99*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
100*a939078aSHiroo HAYASHI # undef fnmatch
101*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_FNMATCH
102*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (fnmatch,
103*a939078aSHiroo HAYASHI                  "fnmatch does not portably work - "
104*a939078aSHiroo HAYASHI                  "use gnulib module fnmatch for portability or gnulib module fnmatch-gnu for a glibc compatible implementation");
105*a939078aSHiroo HAYASHI # endif
106*a939078aSHiroo HAYASHI #endif
107*a939078aSHiroo HAYASHI 
108*a939078aSHiroo HAYASHI 
109*a939078aSHiroo HAYASHI #endif /* _@GUARD_PREFIX@_FNMATCH_H */
110*a939078aSHiroo HAYASHI #endif /* _@GUARD_PREFIX@_FNMATCH_H */
111