| 644 | } |
| 645 | |
| 646 | static int match_mask(const char* mask, const char* string) { |
| 647 | if (mask == NULL) { |
| 648 | return 0; |
| 649 | } |
| 650 | |
| 651 | if (string == NULL) { |
| 652 | return 0; |
| 653 | } |
| 654 | |
| 655 | if ((mask[0] == '*') && (mask[1] == '\0')) { |
| 656 | return 1; /* instant match */ |
| 657 | } |
| 658 | |
| 659 | while (*mask != '\0') { |
| 660 | if (*mask == '*') { |
| 661 | mask++; |
| 662 | switch (match_multi(&mask, &string)) { |
| 663 | case +1: |
| 664 | return 1; |
| 665 | case -1: |
| 666 | return 0; |
| 667 | } |
| 668 | } |
| 669 | else if (*string == '\0') { |
| 670 | return 0; |
| 671 | } |
| 672 | else if ((*mask == '?') || (*mask == *string)) { |
| 673 | mask++; |
| 674 | string++; |
| 675 | } |
| 676 | else { |
| 677 | return 0; |
| 678 | } |
| 679 | } |
| 680 | |
| 681 | if (*string == '\0') { |
| 682 | return 1; |
| 683 | } |
| 684 | else { |
| 685 | return 0; |
| 686 | } |
| 687 | } |
| 688 | #endif |
| 689 | |
| 690 | bool OSDir::linuxAddFileStack(std::string pathName, std::string fileMask, bool bRecursive) { |
no test coverage detected