fnmatch.in.h 3.8 KB

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