flag fields are u_int's
[unix-history] / usr / src / lib / libc / gen / fnmatch.3
CommitLineData
a80f0b27
KB
1.\" Copyright (c) 1989 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Guido van Rossum.
6.\"
91cff1e1 7.\" %sccs.include.redist.man%
a80f0b27 8.\"
91cff1e1 9.\" @(#)fnmatch.3 5.2 (Berkeley) %G%
a80f0b27
KB
10.\"
11.TH FNMATCH 3 ""
12.UC 7
13.SH NAME
14fnmatch \- match filename or pathname
15.SH SYNOPSIS
16.nf
17#include <unistd.h>
18
19int fnmatch(const char *pattern, const char *string, int flags);
20.fi
21.SH DESCRIPTION
22.I Fnmatch
23matches patterns according to the rules used by the shell.
24It checks the string specified by the
25.I string
26argument to see if it matches the pattern specified by the
27.I pattern
28argument.
29.PP
30The
31.I flags
32argument modifies the interpretation of
33.I pattern
34and
35.I string.
36The value of
37.I flags
38is the bitwise inclusive OR of any of the following
39constants, which are defined in the include file
40.IR unistd.h .
41.TP
42FNM_PATHNAME
43Slash characters in
44.I string
45must be explicitly matched by slashes in
46.IR pattern .
47If this flag is not set, then slashes are treated as regular characters.
48.TP
49FNM_QUOTE
50Every occurrence of a backslash (``\e'') followed by a character in
51.I pattern
52is replaced by that character.
53This is done to negate any special meaning for the character.
54.SH RETURNS
55If
56.I string
57matches the pattern specified by
58.IR pattern ,
59then
60.I fnmatch
61returns zero.
62Otherwise,
63.I fnmatch
64returns nonzero.
65.SH SEE ALSO
66sh(1), glob(3), wordexp(3), regexp(3)
67.SH BUGS
68Quotes and slashes in range patterns are not handled correctly.
69.PP
70The pattern ``*'' matches the empty string, even if
71.I FNM_PATHNAME
72is specified.