COHERENT manpages

This page displays the COHERENT manpage for fnmatch() [Match a string with a normal expression].

List of available manpages
Index


fnmatch() -- String Function (libc)

Match a string with a normal expression
#include <fnmatch.h>
int fnmatch(pattern, string, flags)
const char *pattern, *string; int flags;

The function  fnmatch() checks  whether the  string to which  string points
matches the normal expression to which pattern points.  A normal expression
is one that  uses wildcard characters to broaden the  range of strings that
it matches.  For more information, see the Lexicon entry for wildcards.

flags  is   a  bit  map  whose   bits  are  defined  in   the  header  file
<fnmatch.h>. fnmatch() recognizes any or all of following flags:

FNM_NOESCAPE
     Disable recognizing the backslash as an escape character.

     If this flag is not set,  then prefixing a character in pattern with a
     backslash `\' matches that  same character in string. For example, the
     pair `\*'  in pattern matches  a literal `*'  in string; and  the pair
     `\\' in pattern matches `\' in string.

FNM_PATHNAME
     A slash `/' in string matches only a slash in pattern. If this flag is
     set,  then a  `/' in  string will  not match  a wildcard  character in
     pattern.

FNM_PERIOD
     A leading period `.' in string  must be matched exactly by a period in
     pattern. If FNM_PATHNAME is set, then a ``leading'' period is one that
     occurs either  at the beginning  of string or  immediately following a
     slash; if it is not set, then a ``leading'' period is one that appears
     at the  beginning of string. If FNM_PERIOD is  not set, then fnmatch()
     places no special restrictions on matching a period.

If string  matches pattern, fnmatch() returns zero.  If  it does not match,
fnmatch() returns FN_NOMATCH. If an error occurs, fnmatch() returns a value
other than zero or FN_NOMATCH.

See Also

libc,
pnmatch(),
string.h,
wildcards