OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / fnmatch.3
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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.
12 .\"
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.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
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 .\"
28 .TH FNMATCH 3  2000-10-15 "GNU" "Linux Programmer's Manual"
29 .SH NAME
30 fnmatch \- match filename or pathname
31 .SH SYNOPSIS
32 .nf
33 .B #include <fnmatch.h>
34 .sp
35 .BI "int fnmatch(const char *" "pattern" ", const char *" string ", int " flags );
36 .fi
37 .SH DESCRIPTION
38 The
39 .BR fnmatch ()
40 function checks whether the
41 .I string
42 argument matches the
43 .I pattern
44 argument, which is a shell wildcard pattern.
45 .PP
46 The
47 .I flags
48 argument modifies the behavior; it is the bitwise OR of zero or more
49 of the following flags:
50 .TP
51 .B FNM_NOESCAPE
52 If this flag is set, treat backslash as an ordinary character,
53 instead of an escape character.
54 .TP
55 .B FNM_PATHNAME
56 If this flag is set, match a slash in
57 .I string
58 only with a slash in
59 .I pattern
60 and not by an asterisk (*) or a question mark (?) metacharacter,
61 nor by a bracket expression ([]) containing a slash.
62 .TP
63 .B FNM_PERIOD
64 If this flag is set, a leading period in
65 .I string
66 has to be matched exactly by a period in
67 .IR pattern .
68 A period is considered to be leading if it is the first character in
69 .IR string ,
70 or if both
71 .B FNM_PATHNAME
72 is set and the period immediately follows a slash.
73 .TP
74 .B FNM_FILE_NAME
75 This is a GNU synonym for
76 .BR FNM_PATHNAME .
77 .TP
78 .B FNM_LEADING_DIR
79 If this flag (a GNU extension) is set, the pattern is considered to be
80 matched if it matches an initial segment of
81 .I string
82 which is followed by a slash.
83 This flag is mainly for the internal
84 use of glibc and is implemented only in certain cases.
85 .TP
86 .B FNM_CASEFOLD
87 If this flag (a GNU extension) is set, the pattern is matched
88 case-insensitively.
89 .SH RETURN VALUE
90 Zero if
91 .I string
92 matches
93 .IR pattern ,
94 .B FNM_NOMATCH
95 if there is no match or another nonzero value if there is an error.
96 .SH CONFORMING TO
97 POSIX.2.
98 The
99 .BR FNM_FILE_NAME ", " FNM_LEADING_DIR ", and " FNM_CASEFOLD
100 flags are GNU extensions.
101 .SH SEE ALSO
102 .BR sh (1),
103 .BR glob (3),
104 .BR scandir (3),
105 .BR wordexp (3),
106 .BR glob (7)
107 .SH COLOPHON
108 This page is part of release 3.79 of the Linux
109 .I man-pages
110 project.
111 A description of the project,
112 information about reporting bugs,
113 and the latest version of this page,
114 can be found at
115 \%http://www.kernel.org/doc/man\-pages/.