fnmatch.txh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. @deftypefn Replacement int fnmatch (const char *@var{pattern}, @
  2. const char *@var{string}, int @var{flags})
  3. Matches @var{string} against @var{pattern}, returning zero if it
  4. matches, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
  5. wildcards @code{?} to match any one character, @code{*} to match any
  6. zero or more characters, or a set of alternate characters in square
  7. brackets, like @samp{[a-gt8]}, which match one character (@code{a}
  8. through @code{g}, or @code{t}, or @code{8}, in this example) if that one
  9. character is in the set. A set may be inverted (i.e., match anything
  10. except what's in the set) by giving @code{^} or @code{!} as the first
  11. character in the set. To include those characters in the set, list them
  12. as anything other than the first character of the set. To include a
  13. dash in the set, list it last in the set. A backslash character makes
  14. the following character not special, so for example you could match
  15. against a literal asterisk with @samp{\*}. To match a literal
  16. backslash, use @samp{\\}.
  17. @code{flags} controls various aspects of the matching process, and is a
  18. boolean OR of zero or more of the following values (defined in
  19. @code{<fnmatch.h>}):
  20. @table @code
  21. @item FNM_PATHNAME
  22. @itemx FNM_FILE_NAME
  23. @var{string} is assumed to be a path name. No wildcard will ever match
  24. @code{/}.
  25. @item FNM_NOESCAPE
  26. Do not interpret backslashes as quoting the following special character.
  27. @item FNM_PERIOD
  28. A leading period (at the beginning of @var{string}, or if
  29. @code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
  30. @code{?} but must be matched explicitly.
  31. @item FNM_LEADING_DIR
  32. Means that @var{string} also matches @var{pattern} if some initial part
  33. of @var{string} matches, and is followed by @code{/} and zero or more
  34. characters. For example, @samp{foo*} would match either @samp{foobar}
  35. or @samp{foobar/grill}.
  36. @item FNM_CASEFOLD
  37. Ignores case when performing the comparison.
  38. @end table
  39. @end deftypefn