]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/fnmatch.3
Convert to American spelling conventions
[thirdparty/man-pages.git] / man3 / fnmatch.3
1 .\" (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\" License.
23 .\" Modified Sat Jul 24 19:35:54 1993 by Rik Faith (faith@cs.unc.edu)
24 .\" Modified Mon Oct 16 00:16:29 2000 following Joseph S. Myers
25 .\"
26 .TH FNMATCH 3 2000-10-15 "GNU" "Linux Programmer's Manual"
27 .SH NAME
28 fnmatch \- match filename or pathname
29 .SH SYNOPSIS
30 .nf
31 .B #include <fnmatch.h>
32 .sp
33 .BI "int fnmatch(const char *" "pattern" ", const char *" string ", int " flags );
34 .fi
35 .SH DESCRIPTION
36 The
37 .BR fnmatch ()
38 function checks whether the
39 .I string
40 argument matches the
41 .I pattern
42 argument, which is a shell wildcard pattern.
43 .PP
44 The
45 .I flags
46 argument modifies the behavior; it is the bitwise OR of zero or more
47 of the following flags:
48 .TP
49 .B FNM_NOESCAPE
50 If this flag is set, treat backslash as an ordinary character,
51 instead of an escape character.
52 .TP
53 .B FNM_PATHNAME
54 If this flag is set, match a slash in
55 .I string
56 only with a slash in
57 .I pattern
58 and not by an asterisk (*) or a question mark (?) metacharacter,
59 nor by a bracket expression ([]) containing a slash.
60 .TP
61 .B FNM_PERIOD
62 If this flag is set, a leading period in
63 .I string
64 has to be matched exactly by a period in
65 .IR pattern .
66 A period is considered to be leading if it is the first character in
67 .IR string ,
68 or if both
69 .B FNM_PATHNAME
70 is set and the period immediately follows a slash.
71 .TP
72 .B FNM_FILE_NAME
73 This is a GNU synonym for \fBFNM_PATHNAME\fR.
74 .TP
75 .B FNM_LEADING_DIR
76 If this flag (a GNU extension) is set, the pattern is considered to be
77 matched if it matches an initial segment of
78 .I string
79 which is followed by a slash.
80 This flag is mainly for the internal
81 use of glibc and is only implemented in certain cases.
82 .TP
83 .B FNM_CASEFOLD
84 If this flag (a GNU extension) is set, the pattern is matched
85 case-insensitively.
86 .SH "RETURN VALUE"
87 Zero if
88 .I string
89 matches
90 .IR pattern ,
91 .B FNM_NOMATCH
92 if there is no match or another non-zero value if there is an error.
93 .SH "CONFORMING TO"
94 POSIX.2.
95 The
96 .BR FNM_FILE_NAME ", " FNM_LEADING_DIR ", and " FNM_CASEFOLD
97 flags are GNU extensions.
98 .SH "SEE ALSO"
99 .BR sh (1),
100 .BR glob (3),
101 .BR scandir (3),
102 .BR wordexp (3),
103 .BR glob (7)