|
Lines 110-115
match_pattern(const char *s, const char *pattern)
Link Here
|
| 110 |
} |
110 |
} |
| 111 |
|
111 |
|
| 112 |
/* |
112 |
/* |
|
|
113 |
* Tries to match the string against the pattern, possibly preceded by ! to |
| 114 |
* indicate negation). Returns -1 if negation matches, 1 if there is |
| 115 |
* a positive match, 0 if there is no match at all. |
| 116 |
*/ |
| 117 |
|
| 118 |
int |
| 119 |
match_possibly_negated_pattern(const char *s, const char *pattern) |
| 120 |
{ |
| 121 |
int retval_if_matched; |
| 122 |
|
| 123 |
/* inizialize retval_if_matched according to pattern negation, if any */ |
| 124 |
retval_if_matched = 1; |
| 125 |
if (*pattern == '!') { |
| 126 |
retval_if_matched = -1; |
| 127 |
/* eliminate negation character */ |
| 128 |
pattern++; |
| 129 |
} |
| 130 |
|
| 131 |
if (match_pattern(s, pattern)) { |
| 132 |
return retval_if_matched; |
| 133 |
} |
| 134 |
return 0; |
| 135 |
} |
| 136 |
|
| 137 |
/* |
| 113 |
* Tries to match the string against the |
138 |
* Tries to match the string against the |
| 114 |
* comma-separated sequence of subpatterns (each possibly preceded by ! to |
139 |
* comma-separated sequence of subpatterns (each possibly preceded by ! to |
| 115 |
* indicate negation). Returns -1 if negation matches, 1 if there is |
140 |
* indicate negation). Returns -1 if negation matches, 1 if there is |