]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - lib/glob/strmatch.h
Imported from ../bash-2.05a.tar.gz.
[thirdparty/bash.git] / lib / glob / strmatch.h
similarity index 72%
rename from lib/glob/fnmatch.h
rename to lib/glob/strmatch.h
index c6908918c744080248e6a4be382c79898091380e..d31e5929cea3f3bf7744a5002ac9ba93e5fb97cb 100644 (file)
@@ -16,8 +16,14 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc.,
 59 Temple Place, Suite 330, Boston, MA 02111 USA.  */
 
-#ifndef        _FNMATCH_H
-#define        _FNMATCH_H      1
+#ifndef        _STRMATCH_H
+#define        _STRMATCH_H     1
+
+#ifdef HAVE_LIBC_FNM_EXTMATCH
+
+#include <fnmatch.h>
+
+#else /* !HAVE_LIBC_FNM_EXTMATCH */
 
 #include "stdc.h"
 
@@ -27,22 +33,32 @@ not, write to the Free Software Foundation, Inc.,
 #undef  FNM_NOESCAPE
 #undef  FNM_PERIOD
 
-/* Bits set in the FLAGS argument to `fnmatch'.  */
-/* standard flags */
+/* Bits set in the FLAGS argument to `strmatch'.  */
+
+/* standard flags are like fnmatch(3). */
 #define        FNM_PATHNAME    (1 << 0) /* No wildcard can ever match `/'.  */
 #define        FNM_NOESCAPE    (1 << 1) /* Backslashes don't quote special chars.  */
 #define        FNM_PERIOD      (1 << 2) /* Leading `.' is matched only explicitly.  */
 
-/* extended flags */
+/* extended flags not available in most libc fnmatch versions, but we undef
+   them to avoid any possible warnings. */
+#undef FNM_LEADING_DIR
+#undef FNM_CASEFOLD
+#undef FNM_EXTMATCH
+
 #define FNM_LEADING_DIR        (1 << 3) /* Ignore `/...' after a match. */
 #define FNM_CASEFOLD   (1 << 4) /* Compare without regard to case. */
 #define FNM_EXTMATCH   (1 << 5) /* Use ksh-like extended matching. */
 
-/* Value returned by `fnmatch' if STRING does not match PATTERN.  */
+/* Value returned by `strmatch' if STRING does not match PATTERN.  */
+#undef FNM_NOMATCH
+
 #define        FNM_NOMATCH     1
 
 /* Match STRING against the filename pattern PATTERN,
    returning zero if it matches, FNM_NOMATCH if not.  */
-extern int fnmatch __P((char *, char *, int));
+extern int strmatch __P((char *, char *, int));
+
+#endif /* !HAVE_LIBC_FNM_EXTMATCH */
 
-#endif /* _FNMATCH_H */
+#endif /* _STRMATCH_H */