]> git.ipfire.org Git - thirdparty/gcc.git/blame - libiberty/fnmatch.txh
libffi-dg.exp: Set LD_LIBRARY_PATH_64 for SPARC64.
[thirdparty/gcc.git] / libiberty / fnmatch.txh
CommitLineData
aac04c15
DD
1@deftypefn Replacement int fnmatch (const char *@var{pattern}, const char *@var{string}, int @var{flags})
2
3Matches @var{string} against @var{pattern}, returning zero if it
4matches, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
5wildcards @code{?} to match any one character, @code{*} to match any
6zero or more characters, or a set of alternate characters in square
7brackets, like @samp{[a-gt8]}, which match one character (@code{a}
8through @code{g}, or @code{t}, or @code{8}, in this example) if that one
5bed56d9 9character is in the set. A set may be inverted (i.e., match anything
aac04c15
DD
10except what's in the set) by giving @code{^} or @code{!} as the first
11character in the set. To include those characters in the set, list them
12as anything other than the first character of the set. To include a
13dash in the set, list it last in the set. A backslash character makes
14the following character not special, so for example you could match
15against a literal asterisk with @samp{\*}. To match a literal
16backslash, use @samp{\\}.
17
18@code{flags} controls various aspects of the matching process, and is a
19boolean OR of zero or more of the following values (defined in
5bed56d9 20@code{<fnmatch.h>}):
aac04c15
DD
21
22@table @code
23
24@item FNM_PATHNAME
25@itemx FNM_FILE_NAME
26@var{string} is assumed to be a path name. No wildcard will ever match
27@code{/}.
28
29@item FNM_NOESCAPE
30Do not interpret backslashes as quoting the following special character.
31
32@item FNM_PERIOD
33A leading period (at the beginning of @var{string}, or if
34@code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
35@code{?} but must be matched explicitly.
36
37@item FNM_LEADING_DIR
38Means that @var{string} also matches @var{pattern} if some initial part
39of @var{string} matches, and is followed by @code{/} and zero or more
40characters. For example, @samp{foo*} would match either @samp{foobar}
41or @samp{foobar/grill}.
42
43@item FNM_CASEFOLD
44Ignores case when performing the comparison.
45
46@end table
47
48@end deftypefn