fnmatch [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation
MPE/iX Developer's Kit Reference Manual Volume I
fnmatch
Compare filename to pattern (wild card) string.
Syntax
#include <fnmatch.h>
int fnmatch (const char *pattern, const char *string, int flags);
Parameters
pattern Is a string that may contain standard path name matching wild
card characters. For example, asterisk (*), question mark
(?), [] constructs, and so on.
string is a path name you want to compare to pattern.
flags specifies options for the match. Flags are represented by
symbols defined in <fnmatch.h>. Recognized symbols are:
FNM_NOESCAPE disables backslash (\) escaping. When this
flag is not set, the default behaviour is
backslash escaping enabled; that is, if
pattern contains a backslash (\) followed by
a character, fnmatch() matches the character
itself in string regardless of any special
meaning it may have. For example, \\ in
pattern matches \ in string.
FNM_PATHNAME indicates that slash (/) is a special
character in string. For path names to
match, pattern must have a slash wherever
string does. For example, the string
dir/file matches the pattern d* when
FNM_PATHNAME is not given as a flag, but does
not match when FNM_PATHNAME is present.
FNM_PERIOD indicates that a leading period in string
must be matched by a period in pattern. An
asterisk, question mark, or bracket
expression does not match a leading period if
FNM_PERIOD is set.
FNM_IGNORECASE indicates that case is to be ignored when
comparing characters. For example, a matches
A when this flag is set.
Return Values
0 string is a path name matching the wild card construct
pattern.
FNM_ERROR error with the pattern and consequently no match.
FNM_NOMATCHthere is no match.
Description
fnmatch() determines whether string is a path name matching the wild card
construct pattern. If so, fnmatch() returns zero. If there is an error
with the pattern and consequently no match, fmnatch() returns FNM_ERROR.
If there is no match, fnmatch() returns the value FNM_NOMATCH.
Errors
None.
See Also
regcomp(), regexec()
MPE/iX 5.0 Documentation