Commit | Line | Data |
---|---|---|
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 | |
14 | fnmatch \- match filename or pathname | |
15 | .SH SYNOPSIS | |
16 | .nf | |
17 | #include <unistd.h> | |
18 | ||
19 | int fnmatch(const char *pattern, const char *string, int flags); | |
20 | .fi | |
21 | .SH DESCRIPTION | |
22 | .I Fnmatch | |
23 | matches patterns according to the rules used by the shell. | |
24 | It checks the string specified by the | |
25 | .I string | |
26 | argument to see if it matches the pattern specified by the | |
27 | .I pattern | |
28 | argument. | |
29 | .PP | |
30 | The | |
31 | .I flags | |
32 | argument modifies the interpretation of | |
33 | .I pattern | |
34 | and | |
35 | .I string. | |
36 | The value of | |
37 | .I flags | |
38 | is the bitwise inclusive OR of any of the following | |
39 | constants, which are defined in the include file | |
40 | .IR unistd.h . | |
41 | .TP | |
42 | FNM_PATHNAME | |
43 | Slash characters in | |
44 | .I string | |
45 | must be explicitly matched by slashes in | |
46 | .IR pattern . | |
47 | If this flag is not set, then slashes are treated as regular characters. | |
48 | .TP | |
49 | FNM_QUOTE | |
50 | Every occurrence of a backslash (``\e'') followed by a character in | |
51 | .I pattern | |
52 | is replaced by that character. | |
53 | This is done to negate any special meaning for the character. | |
54 | .SH RETURNS | |
55 | If | |
56 | .I string | |
57 | matches the pattern specified by | |
58 | .IR pattern , | |
59 | then | |
60 | .I fnmatch | |
61 | returns zero. | |
62 | Otherwise, | |
63 | .I fnmatch | |
64 | returns nonzero. | |
65 | .SH SEE ALSO | |
66 | sh(1), glob(3), wordexp(3), regexp(3) | |
67 | .SH BUGS | |
68 | Quotes and slashes in range patterns are not handled correctly. | |
69 | .PP | |
70 | The pattern ``*'' matches the empty string, even if | |
71 | .I FNM_PATHNAME | |
72 | is specified. |