Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>fnmatch</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
fnmatch
=======

Syntax
------

     #include <fnmatch.h>
     
     int fnmatch(const char *pattern, const char *string, int flags);

Description
-----------

This function indicates if STRING matches the PATTERN.  The pattern may
include the following special characters:

`*'
     Matches zero of more characters.

`?'
     Matches exactly one character

`[...]'
     Matches one character if it's in a range of characters.  If the
     first character is `!', matches if the character is not in the
     range.  Between the brackets, the range is specified by listing
     the characters that are in the range, or two characters separated
     by `-' to indicate all characters in that range.  For example,
     `[a-d]' matches `a', `b', `c', or `d'.

`\'
     Causes the next character to not be treated as a wildcard.  For
     example, `\*' matches an asterisk.  This is only available if FLAGS
     includes `FNM_QUOTE'.

The value of FLAGS is a combination of zero of more of the following:

`FNM_PATHNAME'
     This means that the string should be treated as a pathname, in
     that the slash character `/' never matches any of the wildcards.

`FNM_QUOTE'
     This means that the backslash `\\' may be used for quoting special
     characters in the pattern.

Return Value
------------

Zero if the string matches, FNM_NOMATCH if it does not.

Example
-------

     if (fnmatch("*.[ch]", filename, FNM_PATH|FNM_QUOTE))
       do_source_file(filename);


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson