fnmatch.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*++
  2. Copyright (c) 2015 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. fnmatch.h
  9. Abstract:
  10. This header contains the definition of the fnmatch function, used for
  11. pattern matching.
  12. Author:
  13. Evan Green 10-Feb-2015
  14. --*/
  15. #ifndef _FNMATCH_H
  16. #define _FNMATCH_H
  17. //
  18. // ------------------------------------------------------------------- Includes
  19. //
  20. #include <libcbase.h>
  21. //
  22. // ---------------------------------------------------------------- Definitions
  23. //
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. //
  28. // Define flags that can be passed in to fnmatch.
  29. //
  30. //
  31. // If this flag is set, wildcards will not match slashes '/'.
  32. //
  33. #define FNM_PATHNAME 0x00000001
  34. //
  35. // If this flag is set, backslashes don't quote special characters.
  36. //
  37. #define FNM_NOESCAPE 0x00000002
  38. //
  39. // If this flag is set, a leading period is matched explicitly.
  40. //
  41. #define FNM_PERIOD 0x00000004
  42. //
  43. // If this flag is set, ignore the remainder of a path (/...) after a match.
  44. //
  45. #define FNM_LEADING_DIR 0x00000008
  46. //
  47. // If this flag is set, case is ignored.
  48. //
  49. #define FNM_CASEFOLD 0x00000010
  50. //
  51. // This value is returned by fnmatch if there is no match.
  52. //
  53. #define FNM_NOMATCH 1
  54. //
  55. // ------------------------------------------------------ Data Type Definitions
  56. //
  57. //
  58. // -------------------------------------------------------------------- Globals
  59. //
  60. //
  61. // -------------------------------------------------------- Function Prototypes
  62. //
  63. LIBC_API
  64. int
  65. fnmatch (
  66. const char *Pattern,
  67. const char *String,
  68. int Flags
  69. );
  70. /*++
  71. Routine Description:
  72. This routine matches patterns as described by POSIX in the shell grammar
  73. sections of "Patterns Matching a Single Character", "Patterns Matching
  74. Multiple Characters", and "Patterns Used for Filename Expansion".
  75. Arguments:
  76. Pattern - Supplies a pointer to the null terminated pattern string.
  77. String - Supplies a pointer to the null terminated string to match against.
  78. Flags - Supplies a bitfield of flags governing the behavior of the matching
  79. function. See FNM_* definitions.
  80. Return Value:
  81. 0 if the pattern matches.
  82. FNM_NOMATCH if the pattern does not match.
  83. -1 on error.
  84. --*/
  85. #ifdef __cplusplus
  86. }
  87. #endif
  88. #endif