| 162 | } |
| 163 | |
| 164 | static int match_mask(const char* mask, const char* string) { |
| 165 | if (mask == NULL) { |
| 166 | return 0; |
| 167 | } |
| 168 | |
| 169 | if (string == NULL) { |
| 170 | return 0; |
| 171 | } |
| 172 | |
| 173 | if ((mask[0] == '*') && (mask[1] == '\0')) { |
| 174 | return 1; /* instant match */ |
| 175 | } |
| 176 | |
| 177 | while (*mask != '\0') { |
| 178 | if (*mask == '*') { |
| 179 | mask++; |
| 180 | switch (match_multi(&mask, &string)) { |
| 181 | case +1: |
| 182 | return 1; |
| 183 | case -1: |
| 184 | return 0; |
| 185 | } |
| 186 | } |
| 187 | else if (*string == '\0') { |
| 188 | return 0; |
| 189 | } |
| 190 | else if ((*mask == '?') || (*mask == *string)) { |
| 191 | mask++; |
| 192 | string++; |
| 193 | } |
| 194 | else { |
| 195 | return 0; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | if (*string == '\0') { |
| 200 | return 1; |
| 201 | } |
| 202 | else { |
| 203 | return 0; |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | bool LinuxAddFileStack(const char* szPathName, const char* fileMask, |
| 208 | bool bRecursive, std::vector<std::string> &list, |
no test coverage detected