home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / posix / fnmatch / fnmatch.txh < prev    next >
Encoding:
Text File  |  1995-07-10  |  1.7 KB  |  71 lines

  1. @c ----------------------------------------------------------------------
  2. @node fnmatch, file system
  3. @subheading Syntax
  4.  
  5. @example
  6. #include <fnmatch.h>
  7.  
  8. int fnmatch(const char *pattern, const char *string, int flags);
  9. @end example
  10.  
  11. @subheading Description
  12.  
  13. This function indicates if @var{string} matches the @var{pattern}.  The
  14. pattern may include the following special characters:
  15.  
  16. @table @code
  17.  
  18. @item *
  19.  
  20. Matches zero of more characters.
  21.  
  22. @item ?
  23.  
  24. Matches exactly one character
  25.  
  26. @item [...]
  27.  
  28. Matches one character if it's in a range of characters.  If the first
  29. character is @code{!}, matches if the character is not in the range. 
  30. Between the brackets, the range is specified by listing the characters
  31. that are in the range, or two characters separated by @code{-} to
  32. indicate all characters in that range.  For example, @code{[a-d]}
  33. matches @code{a}, @code{b}, @code{c}, or @code{d}. 
  34.  
  35. @item \
  36.  
  37. Causes the next character to not be treated as a wildcard.  For example,
  38. @code{\*} matches an asterisk.  This is only available if @var{flags}
  39. includes @code{FNM_QUOTE}. 
  40.  
  41. @end table
  42.  
  43. The value of @var{flags} is a combination of zero of more of the
  44. following:
  45.  
  46. @table @code
  47.  
  48. @item FNM_PATHNAME
  49.  
  50. This means that the string should be treated as a pathname, in that the
  51. slash character @code{/} never matches any of the wildcards. 
  52.  
  53. @item FNM_QUOTE
  54.  
  55. This means that the backslash @code{\\} may be used for quoting special
  56. characters in the pattern. 
  57.  
  58. @end table
  59.  
  60. @subheading Return Value
  61.  
  62. Zero if the string matches, FNM_NOMATCH if it does not.
  63.  
  64. @subheading Example
  65.  
  66. @example
  67. if (fnmatch("*.[ch]", filename, FNM_PATH|FNM_QUOTE))
  68.   do_source_file(filename);
  69. @end example
  70.  
  71.