MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / match_mask

Function match_mask

src/common/OSFile.cpp:646–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

644}
645
646static 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
690bool OSDir::linuxAddFileStack(std::string pathName, std::string fileMask, bool bRecursive) {

Callers 1

linuxAddFileStackMethod · 0.70

Calls 1

match_multiFunction · 0.70

Tested by

no test coverage detected