OSDN Git Service

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