]>
Commit | Line | Data |
---|---|---|
bf5a7247 | 1 | .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) |
fea681da | 2 | .\" |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
c08df37a | 24 | .\" |
fea681da MK |
25 | .\" Modified Sat Jul 24 19:35:54 1993 by Rik Faith (faith@cs.unc.edu) |
26 | .\" Modified Mon Oct 16 00:16:29 2000 following Joseph S. Myers | |
27 | .\" | |
9ba01802 | 28 | .TH FNMATCH 3 2019-03-06 "GNU" "Linux Programmer's Manual" |
fea681da MK |
29 | .SH NAME |
30 | fnmatch \- match filename or pathname | |
31 | .SH SYNOPSIS | |
32 | .nf | |
33 | .B #include <fnmatch.h> | |
68e4db0a | 34 | .PP |
fea681da MK |
35 | .BI "int fnmatch(const char *" "pattern" ", const char *" string ", int " flags ); |
36 | .fi | |
37 | .SH DESCRIPTION | |
38 | The | |
63aa9df0 | 39 | .BR fnmatch () |
fea681da MK |
40 | function checks whether the |
41 | .I string | |
42 | argument matches the | |
43 | .I pattern | |
06e9098e EH |
44 | argument, which is a shell wildcard pattern (see |
45 | .BR glob (7)). | |
fea681da MK |
46 | .PP |
47 | The | |
48 | .I flags | |
d9bfdb9c | 49 | argument modifies the behavior; it is the bitwise OR of zero or more |
fea681da MK |
50 | of the following flags: |
51 | .TP | |
52 | .B FNM_NOESCAPE | |
53 | If this flag is set, treat backslash as an ordinary character, | |
54 | instead of an escape character. | |
55 | .TP | |
56 | .B FNM_PATHNAME | |
57 | If this flag is set, match a slash in | |
58 | .I string | |
59 | only with a slash in | |
60 | .I pattern | |
c13182ef | 61 | and not by an asterisk (*) or a question mark (?) metacharacter, |
73dc32f0 | 62 | nor by a bracket expression ([]) containing a slash. |
fea681da MK |
63 | .TP |
64 | .B FNM_PERIOD | |
65 | If this flag is set, a leading period in | |
66 | .I string | |
67 | has to be matched exactly by a period in | |
68 | .IR pattern . | |
69 | A period is considered to be leading if it is the first character in | |
70 | .IR string , | |
71 | or if both | |
c13182ef | 72 | .B FNM_PATHNAME |
fea681da MK |
73 | is set and the period immediately follows a slash. |
74 | .TP | |
75 | .B FNM_FILE_NAME | |
c9942389 MK |
76 | This is a GNU synonym for |
77 | .BR FNM_PATHNAME . | |
fea681da MK |
78 | .TP |
79 | .B FNM_LEADING_DIR | |
80 | If this flag (a GNU extension) is set, the pattern is considered to be | |
81 | matched if it matches an initial segment of | |
82 | .I string | |
c13182ef MK |
83 | which is followed by a slash. |
84 | This flag is mainly for the internal | |
33a0ccb2 | 85 | use of glibc and is implemented only in certain cases. |
fea681da MK |
86 | .TP |
87 | .B FNM_CASEFOLD | |
88 | If this flag (a GNU extension) is set, the pattern is matched | |
89 | case-insensitively. | |
b664d38d PB |
90 | .TP |
91 | .B FNM_EXTMATCH | |
92 | If this flag (a GNU extension) is set, extended patterns are | |
93 | supported, as introduced by \&'ksh' and now supported by other shells. | |
94 | The extended format is as follows, with \fIpattern\-list\fR | |
95 | being a \&'|' separated list of patterns. | |
96 | .TP | |
97 | \&'?(\fIpattern\-list\fR)' | |
98 | The pattern matches if zero or one occurrences of any of the | |
99 | patterns in the \fIpattern\-list\fR match the input \fIstring\fR. | |
100 | .TP | |
101 | \&'*(\fIpattern\-list\fR)' | |
102 | The pattern matches if zero or more occurrences of any of the | |
103 | patterns in the \fIpattern\-list\fR match the input \fIstring\fR. | |
104 | .TP | |
105 | \&'+(\fIpattern\-list\fR)' | |
106 | The pattern matches if one or more occurrences of any of the | |
107 | patterns in the \fIpattern\-list\fR match the input \fIstring\fR. | |
108 | .TP | |
109 | \&'@(\fIpattern\-list\fR)' | |
110 | The pattern matches if exactly one occurrence of any of the | |
111 | patterns in the \fIpattern\-list\fR match the input \fIstring\fR. | |
112 | .TP | |
113 | \&'!(\fIpattern\-list\fR)' | |
114 | The pattern matches if the input \fIstring\fR cannot be matched with | |
115 | any of the patterns in the \fIpattern\-list\fR. | |
47297adb | 116 | .SH RETURN VALUE |
fea681da MK |
117 | Zero if |
118 | .I string | |
119 | matches | |
120 | .IR pattern , | |
121 | .B FNM_NOMATCH | |
c7094399 | 122 | if there is no match or another nonzero value if there is an error. |
a3c84dde PH |
123 | .SH ATTRIBUTES |
124 | For an explanation of the terms used in this section, see | |
125 | .BR attributes (7). | |
126 | .TS | |
127 | allbox; | |
128 | lb lb lb | |
129 | l l l. | |
130 | Interface Attribute Value | |
131 | T{ | |
132 | .BR fnmatch () | |
133 | T} Thread safety MT-Safe env locale | |
134 | .TE | |
47297adb | 135 | .SH CONFORMING TO |
035bf164 | 136 | POSIX.1-2001, POSIX.1-2008, POSIX.2. |
68e1685c | 137 | The |
fea681da MK |
138 | .BR FNM_FILE_NAME ", " FNM_LEADING_DIR ", and " FNM_CASEFOLD |
139 | flags are GNU extensions. | |
47297adb | 140 | .SH SEE ALSO |
fea681da MK |
141 | .BR sh (1), |
142 | .BR glob (3), | |
143 | .BR scandir (3), | |
2ff9c803 | 144 | .BR wordexp (3), |
fea681da | 145 | .BR glob (7) |