HuntnGather – Diff between revs 45 and 49
?pathlinks?
Rev 45 | Rev 49 | |||
---|---|---|---|---|
Line 674... | Line 674... | |||
674 | } |
674 | } |
|
Line 675... | Line 675... | |||
675 | |
675 | |
|
676 | return entry; |
676 | return entry; |
|
Line 677... | Line -... | |||
677 | } |
- | ||
678 | |
- | ||
679 | /* |
- | ||
680 | * Compare two strings. |
- | ||
681 | */ |
- | ||
682 | #if defined ___AmigaOS___ |
- | ||
683 | BOOL StringMatch(char *a, char *b) { |
- | ||
684 | #else |
- | ||
685 | int StringMatch(char *a, char *b) { |
- | ||
686 | #endif |
- | ||
687 | #if defined ___AmigaOS___ |
- | ||
688 | ULONG size; |
- | ||
689 | BOOL success; |
- | ||
690 | UBYTE *pattern; |
- | ||
691 | char *e = a; |
- | ||
692 | char *n = b; |
- | ||
693 | |
- | ||
694 | #if defined ___NOCASE_FS___ |
- | ||
695 | StrUpr(e); |
- | ||
696 | StrUpr(n); |
- | ||
697 | #endif |
- | ||
698 | |
- | ||
699 | // "must be at least 2 times as large plus 2 bytes" |
- | ||
700 | size = strlen(n) * 2 + 2; |
- | ||
701 | |
- | ||
702 | success = FALSE; |
- | ||
703 | |
- | ||
704 | if(pattern = AllocVec(size, MEMF_ANY|MEMF_CLEAR)) { |
- | ||
705 | switch(ParsePatternNoCase(n, pattern, (LONG)size)) { |
- | ||
706 | case 1: // the pattern contains wildcards |
- | ||
707 | success = MatchPatternNoCase(pattern, e); |
- | ||
708 | |
- | ||
709 | break; |
- | ||
710 | case 0: // no wildcards so fall back to exact name match |
- | ||
711 | #if defined ___NOCASE_FS___ |
- | ||
712 | success = (Strnicmp(e, n, StringLenMax(e, n)) == 0); |
- | ||
713 | #else |
- | ||
714 | success = (StrnCmp(e, n, StringLenMax(e, n)) == 0); |
- | ||
715 | #endif |
- | ||
716 | |
- | ||
717 | break; |
- | ||
718 | } |
- | ||
719 | |
- | ||
720 | FreeVec(pattern); |
- | ||
721 | pattern = NULL; |
- | ||
722 | } |
- | ||
723 | |
- | ||
724 | return success; |
- | ||
725 | #else |
- | ||
726 | int success; |
- | ||
727 | char *e = a; |
- | ||
728 | char *n = b; |
- | ||
729 | |
- | ||
730 | success = FALSE; |
- | ||
731 | |
- | ||
732 | #if defined ___NOCASE_FS___ |
- | ||
733 | StrUpr(e); |
- | ||
734 | StrUpr(n); |
- | ||
735 | #endif |
- | ||
736 | |
- | ||
737 | // search for substring |
- | ||
738 | success = strstr(e, n) != NULL; |
- | ||
739 | |
- | ||
740 | return success; |
- | ||
741 | #endif |
- |