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