]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fnmatch.3
getent.1, intro.1, time.1, _exit.2, _syscall.2, accept.2, access.2, acct.2, adjtimex...
[thirdparty/man-pages.git] / man3 / fnmatch.3
CommitLineData
bf5a7247 1.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
fea681da
MK
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.
c13182ef 11.\"
fea681da
MK
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.
c13182ef 19.\"
fea681da
MK
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
28fnmatch \- 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
36The
63aa9df0 37.BR fnmatch ()
fea681da
MK
38function checks whether the
39.I string
40argument matches the
41.I pattern
42argument, which is a shell wildcard pattern.
43.PP
44The
45.I flags
d9bfdb9c 46argument modifies the behavior; it is the bitwise OR of zero or more
fea681da
MK
47of the following flags:
48.TP
49.B FNM_NOESCAPE
50If this flag is set, treat backslash as an ordinary character,
51instead of an escape character.
52.TP
53.B FNM_PATHNAME
54If this flag is set, match a slash in
55.I string
56only with a slash in
57.I pattern
c13182ef 58and not by an asterisk (*) or a question mark (?) metacharacter,
73dc32f0 59nor by a bracket expression ([]) containing a slash.
fea681da
MK
60.TP
61.B FNM_PERIOD
62If this flag is set, a leading period in
63.I string
64has to be matched exactly by a period in
65.IR pattern .
66A period is considered to be leading if it is the first character in
67.IR string ,
68or if both
c13182ef 69.B FNM_PATHNAME
fea681da
MK
70is set and the period immediately follows a slash.
71.TP
72.B FNM_FILE_NAME
73This is a GNU synonym for \fBFNM_PATHNAME\fR.
74.TP
75.B FNM_LEADING_DIR
76If this flag (a GNU extension) is set, the pattern is considered to be
77matched if it matches an initial segment of
78.I string
c13182ef
MK
79which is followed by a slash.
80This flag is mainly for the internal
fea681da
MK
81use of glibc and is only implemented in certain cases.
82.TP
83.B FNM_CASEFOLD
84If this flag (a GNU extension) is set, the pattern is matched
85case-insensitively.
47297adb 86.SH RETURN VALUE
fea681da
MK
87Zero if
88.I string
89matches
90.IR pattern ,
91.B FNM_NOMATCH
c7094399 92if there is no match or another nonzero value if there is an error.
47297adb 93.SH CONFORMING TO
c13182ef 94POSIX.2.
68e1685c 95The
fea681da
MK
96.BR FNM_FILE_NAME ", " FNM_LEADING_DIR ", and " FNM_CASEFOLD
97flags are GNU extensions.
47297adb 98.SH SEE ALSO
fea681da
MK
99.BR sh (1),
100.BR glob (3),
101.BR scandir (3),
2ff9c803 102.BR wordexp (3),
fea681da 103.BR glob (7)