1FNMATCH(3) Linux Programmer's Manual FNMATCH(3)
2
3
4
6 fnmatch - match filename or pathname
7
9 #include <fnmatch.h>
10
11 int fnmatch(const char *pattern, const char *string, int flags);
12
14 The fnmatch() function checks whether the string argument matches the
15 pattern argument, which is a shell wildcard pattern.
16
17 The flags argument modifies the behavior; it is the bitwise OR of zero
18 or more of the following flags:
19
20 FNM_NOESCAPE
21 If this flag is set, treat backslash as an ordinary character,
22 instead of an escape character.
23
24 FNM_PATHNAME
25 If this flag is set, match a slash in string only with a slash
26 in pattern and not by an asterisk (*) or a question mark (?)
27 metacharacter, nor by a bracket expression ([]) containing a
28 slash.
29
30 FNM_PERIOD
31 If this flag is set, a leading period in string has to be
32 matched exactly by a period in pattern. A period is considered
33 to be leading if it is the first character in string, or if both
34 FNM_PATHNAME is set and the period immediately follows a slash.
35
36 FNM_FILE_NAME
37 This is a GNU synonym for FNM_PATHNAME.
38
39 FNM_LEADING_DIR
40 If this flag (a GNU extension) is set, the pattern is considered
41 to be matched if it matches an initial segment of string which
42 is followed by a slash. This flag is mainly for the internal
43 use of glibc and is only implemented in certain cases.
44
45 FNM_CASEFOLD
46 If this flag (a GNU extension) is set, the pattern is matched
47 case-insensitively.
48
50 Zero if string matches pattern, FNM_NOMATCH if there is no match or
51 another nonzero value if there is an error.
52
54 POSIX.2. The FNM_FILE_NAME, FNM_LEADING_DIR, and FNM_CASEFOLD flags
55 are GNU extensions.
56
58 sh(1), glob(3), scandir(3), wordexp(3), glob(7)
59
61 This page is part of release 3.25 of the Linux man-pages project. A
62 description of the project, and information about reporting bugs, can
63 be found at http://www.kernel.org/doc/man-pages/.
64
65
66
67GNU 2000-10-15 FNMATCH(3)