| 1 |
.TH FNMATCH 3am "Feb 21 2018" "Free Software Foundation" "GNU Awk Extension Modules" |
| 2 |
.SH NAME |
| 3 |
fnmatch \- compare a string against a filename wildcard |
| 4 |
.SH SYNOPSIS |
| 5 |
.ft CW |
| 6 |
@load "fnmatch" |
| 7 |
.sp |
| 8 |
result = fnmatch(pattern, string, flags) |
| 9 |
.ft R |
| 10 |
.SH DESCRIPTION |
| 11 |
The |
| 12 |
.I fnmatch |
| 13 |
extension provides an AWK interface to the |
| 14 |
.IR fnmatch (3) |
| 15 |
routine. It adds a single function named |
| 16 |
.BR fnmatch() , |
| 17 |
one predefined variable |
| 18 |
.RB ( FNM_NOMATCH ), |
| 19 |
and an array of flag values named |
| 20 |
.BR FNM . |
| 21 |
.PP |
| 22 |
The first argument is the filename wildcard to match, the second |
| 23 |
is the filename string, and the third is either zero, |
| 24 |
or the bitwise OR of one or more of the flags in the |
| 25 |
.B FNM |
| 26 |
array. |
| 27 |
.PP |
| 28 |
The return value is zero on success, |
| 29 |
.B FNM_NOMATCH |
| 30 |
if the string did not match the pattern, or |
| 31 |
a different non-zero value if an error occurred. |
| 32 |
.PP |
| 33 |
The flags are follows: |
| 34 |
.TP |
| 35 |
\fBFNM["CASEFOLD"]\fP |
| 36 |
Corresponds to the |
| 37 |
.B FNM_CASEFOLD |
| 38 |
flag as defined in |
| 39 |
.IR fnmatch (3). |
| 40 |
.TP |
| 41 |
\fBFNM["FILE_NAME"]\fP |
| 42 |
Corresponds to the |
| 43 |
.B FNM_FILE_NAME |
| 44 |
flag as defined in |
| 45 |
.IR fnmatch (3). |
| 46 |
.TP |
| 47 |
\fBFNM["LEADING_DIR"]\fP |
| 48 |
Corresponds to the |
| 49 |
.B FNM_LEADING_DIR |
| 50 |
flag as defined in |
| 51 |
.IR fnmatch (3). |
| 52 |
.TP |
| 53 |
\fBFNM["NOESCAPE"]\fP |
| 54 |
Corresponds to the |
| 55 |
.B FNM_NOESCAPE |
| 56 |
flag as defined in |
| 57 |
.IR fnmatch (3). |
| 58 |
.TP |
| 59 |
\fBFNM["PATHNAME"]\fP |
| 60 |
Corresponds to the |
| 61 |
.B FNM_PATHNAME |
| 62 |
flag as defined in |
| 63 |
.IR fnmatch (3). |
| 64 |
.TP |
| 65 |
\fBFNM["PERIOD"]\fP |
| 66 |
Corresponds to the |
| 67 |
.B FNM_PERIOD |
| 68 |
flag as defined in |
| 69 |
.IR fnmatch (3). |
| 70 |
.PP |
| 71 |
.SH NOTES |
| 72 |
Nothing prevents AWK code from changing the predefined |
| 73 |
variable |
| 74 |
.BR FNM_NOMATCH , |
| 75 |
but doing so may cause strange results. |
| 76 |
.\" .SH BUGS |
| 77 |
.SH EXAMPLE |
| 78 |
.ft CW |
| 79 |
.nf |
| 80 |
@load "fnmatch" |
| 81 |
\&... |
| 82 |
flags = or(FNM["PERIOD"], FNM["NOESCAPE"]) |
| 83 |
if (fnmatch("*.a", "foo.c", flags) == FNM_NOMATCH) |
| 84 |
print "no match" |
| 85 |
.fi |
| 86 |
.ft R |
| 87 |
.SH "SEE ALSO" |
| 88 |
.IR "GAWK: Effective AWK Programming" , |
| 89 |
.IR filefuncs (3am), |
| 90 |
.IR fork (3am), |
| 91 |
.IR inplace (3am), |
| 92 |
.IR ordchr (3am), |
| 93 |
.IR readdir (3am), |
| 94 |
.IR readfile (3am), |
| 95 |
.IR revoutput (3am), |
| 96 |
.IR rwarray (3am), |
| 97 |
.IR time (3am). |
| 98 |
.PP |
| 99 |
.IR fnmatch (3). |
| 100 |
.SH AUTHOR |
| 101 |
Arnold Robbins, |
| 102 |
.BR [email protected] . |
| 103 |
.SH COPYING PERMISSIONS |
| 104 |
Copyright \(co 2012, 2013, 2018, |
| 105 |
Free Software Foundation, Inc. |
| 106 |
.PP |
| 107 |
Permission is granted to make and distribute verbatim copies of |
| 108 |
this manual page provided the copyright notice and this permission |
| 109 |
notice are preserved on all copies. |
| 110 |
.ig |
| 111 |
Permission is granted to process this file through troff and print the |
| 112 |
results, provided the printed document carries copying permission |
| 113 |
notice identical to this one except for the removal of this paragraph |
| 114 |
(this paragraph not being relevant to the printed manual page). |
| 115 |
.. |
| 116 |
.PP |
| 117 |
Permission is granted to copy and distribute modified versions of this |
| 118 |
manual page under the conditions for verbatim copying, provided that |
| 119 |
the entire resulting derived work is distributed under the terms of a |
| 120 |
permission notice identical to this one. |
| 121 |
.PP |
| 122 |
Permission is granted to copy and distribute translations of this |
| 123 |
manual page into another language, under the above conditions for |
| 124 |
modified versions, except that this permission notice may be stated in |
| 125 |
a translation approved by the Foundation. |
| 126 |
.\" vim: set filetype=nroff : |