Go to the first, previous, next, last section, table of contents.
#include <fnmatch.h> int fnmatch(const char *pattern, const char *string, int flags);
This function indicates if string matches the pattern. The pattern may include the following special characters:
*
?
[...]
\
FNM_NOESCAPE
, in which case `\' is
treated as a directory separator.
The value of flags is a combination of zero of more of the following:
FNM_PATHNAME
FNM_NOESCAPE
FNM_NOCASE
fnmatch
matches characters
case-insensitively, including in character ranges like [a-f]
.
Note that the case-folding is done by calling toupper
(see section toupper), and thus might be sensitive to the current locale.
FNM_PERIOD
FNM_PATHNAME
is set, a
dot after a slash also doesn't match any wildcards.
The DJGPP implementation treats forward slashes and backslashes as equal
when FNM_NOESCAPE
is set, since on DOS/Windows these two
characters are both used as directory separators in file names.
Zero if the string matches, FNM_NOMATCH
if it does not. Posix
defines an additional FNM_ERROR
code that's returned in case of
an error, but the current implementation never returns it.
not ANSI, POSIX (see note 1)
Notes:
if (fnmatch("*.[ch]", filename, FNM_PATHNAME|FNM_NOCASE)) do_source_file(filename);
Go to the first, previous, next, last section, table of contents.