1 /* strmatch.c -- ksh-like extended pattern matching for the shell and filename
4 /* Copyright (C) 1991-2002 Free Software Foundation, Inc.
6 This file is part of GNU Bash, the Bourne Again SHell.
8 Bash is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
13 Bash is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License along
19 with Bash; see the file COPYING. If not, write to the Free Software
20 Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
27 /* Structured this way so that if HAVE_LIBC_FNM_EXTMATCH is defined, the
28 matching portion of the library (smatch.c) is not linked into the shell. */
30 #ifndef HAVE_LIBC_FNM_EXTMATCH
31 extern int xstrmatch __P((char *, char *, int));
33 # define xstrmatch fnmatch
37 strmatch (pattern, string, flags)
42 if (string == 0 || pattern == 0)
45 return (xstrmatch (pattern, string, flags));
58 if (strmatch (pat, string, 0) == 0)
60 printf ("%s matches %s\n", string, pat);
65 printf ("%s does not match %s\n", string, pat);