man-pages/man3/fnmatch.3am.html
2021-03-31 01:06:50 +01:00

203 lines
4.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of FNMATCH</TITLE>
</HEAD><BODY>
<H1>FNMATCH</H1>
Section: GNU Awk Extension Modules (3am)<BR>Updated: Feb 21 2018<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
fnmatch - compare a string against a filename wildcard
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
@load &quot;fnmatch&quot;
<P>
result = fnmatch(pattern, string, flags)
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The
<I>fnmatch</I>
extension provides an AWK interface to the
<I><A HREF="/cgi-bin/man/man2html?3+fnmatch">fnmatch</A></I>(3)
routine. It adds a single function named
<B>fnmatch()</B>,
one predefined variable
(<B>FNM_NOMATCH</B>),
and an array of flag values named
<B>FNM</B>.
<P>
The first argument is the filename wildcard to match, the second
is the filename string, and the third is either zero,
or the bitwise OR of one or more of the flags in the
<B>FNM</B>
array.
<P>
The return value is zero on success,
<B>FNM_NOMATCH</B>
if the string did not match the pattern, or
a different non-zero value if an error occurred.
<P>
The flags are follows:
<DL COMPACT>
<DT id="1"><B>FNM[&quot;CASEFOLD&quot;]</B><DD>
Corresponds to the
<B>FNM_CASEFOLD</B>
flag as defined in
<I><A HREF="/cgi-bin/man/man2html?3+fnmatch">fnmatch</A></I>(3).
<DT id="2"><B>FNM[&quot;FILE_NAME&quot;]</B><DD>
Corresponds to the
<B>FNM_FILE_NAME</B>
flag as defined in
<I><A HREF="/cgi-bin/man/man2html?3+fnmatch">fnmatch</A></I>(3).
<DT id="3"><B>FNM[&quot;LEADING_DIR&quot;]</B><DD>
Corresponds to the
<B>FNM_LEADING_DIR</B>
flag as defined in
<I><A HREF="/cgi-bin/man/man2html?3+fnmatch">fnmatch</A></I>(3).
<DT id="4"><B>FNM[&quot;NOESCAPE&quot;]</B><DD>
Corresponds to the
<B>FNM_NOESCAPE</B>
flag as defined in
<I><A HREF="/cgi-bin/man/man2html?3+fnmatch">fnmatch</A></I>(3).
<DT id="5"><B>FNM[&quot;PATHNAME&quot;]</B><DD>
Corresponds to the
<B>FNM_PATHNAME</B>
flag as defined in
<I><A HREF="/cgi-bin/man/man2html?3+fnmatch">fnmatch</A></I>(3).
<DT id="6"><B>FNM[&quot;PERIOD&quot;]</B><DD>
Corresponds to the
<B>FNM_PERIOD</B>
flag as defined in
<I><A HREF="/cgi-bin/man/man2html?3+fnmatch">fnmatch</A></I>(3).
</DL>
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>NOTES</H2>
Nothing prevents AWK code from changing the predefined
variable
<B>FNM_NOMATCH</B>,
but doing so may cause strange results.
<A NAME="lbAF">&nbsp;</A>
<H2>EXAMPLE</H2>
<PRE>
@load &quot;fnmatch&quot;
...
flags = or(FNM[&quot;PERIOD&quot;], FNM[&quot;NOESCAPE&quot;])
if (fnmatch(&quot;*.a&quot;, &quot;foo.c&quot;, flags) == FNM_NOMATCH)
print &quot;no match&quot;
</PRE>
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<I>GAWK: Effective AWK Programming</I>,
<I>filefuncs</I>(3am),
<I>fork</I>(3am),
<I>inplace</I>(3am),
<I>ordchr</I>(3am),
<I>readdir</I>(3am),
<I>readfile</I>(3am),
<I>revoutput</I>(3am),
<I>rwarray</I>(3am),
<I>time</I>(3am).
<P>
<I><A HREF="/cgi-bin/man/man2html?3+fnmatch">fnmatch</A></I>(3).
<A NAME="lbAH">&nbsp;</A>
<H2>AUTHOR</H2>
Arnold Robbins,
<B><A HREF="mailto:arnold@skeeve.com">arnold@skeeve.com</A></B>.
<A NAME="lbAI">&nbsp;</A>
<H2>COPYING PERMISSIONS</H2>
Copyright &#169; 2012, 2013, 2018,
Free Software Foundation, Inc.
<P>
Permission is granted to make and distribute verbatim copies of
this manual page provided the copyright notice and this permission
notice are preserved on all copies.
<P>
Permission is granted to copy and distribute modified versions of this
manual page under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
<P>
Permission is granted to copy and distribute translations of this
manual page into another language, under the above conditions for
modified versions, except that this permission notice may be stated in
a translation approved by the Foundation.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="7"><A HREF="#lbAB">NAME</A><DD>
<DT id="8"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="9"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="10"><A HREF="#lbAE">NOTES</A><DD>
<DT id="11"><A HREF="#lbAF">EXAMPLE</A><DD>
<DT id="12"><A HREF="#lbAG">SEE ALSO</A><DD>
<DT id="13"><A HREF="#lbAH">AUTHOR</A><DD>
<DT id="14"><A HREF="#lbAI">COPYING PERMISSIONS</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:43 GMT, March 31, 2021
</BODY>
</HTML>