HuntnGather

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 48  →  ?path2? @ 49
/trunk/HuntnGather/shared/utilities.c
@@ -676,72 +676,7 @@
return entry;
}
 
/*
* Compare two strings.
*/
#if defined ___AmigaOS___
BOOL StringMatch(char *a, char *b) {
#else
int StringMatch(char *a, char *b) {
#endif
#if defined ___AmigaOS___
ULONG size;
BOOL success;
UBYTE *pattern;
char *e = a;
char *n = b;
 
#if defined ___NOCASE_FS___
StrUpr(e);
StrUpr(n);
#endif
 
// "must be at least 2 times as large plus 2 bytes"
size = strlen(n) * 2 + 2;
 
success = FALSE;
 
if(pattern = AllocVec(size, MEMF_ANY|MEMF_CLEAR)) {
switch(ParsePatternNoCase(n, pattern, (LONG)size)) {
case 1: // the pattern contains wildcards
success = MatchPatternNoCase(pattern, e);
 
break;
case 0: // no wildcards so fall back to exact name match
#if defined ___NOCASE_FS___
success = (Strnicmp(e, n, StringLenMax(e, n)) == 0);
#else
success = (StrnCmp(e, n, StringLenMax(e, n)) == 0);
#endif
 
break;
}
 
FreeVec(pattern);
pattern = NULL;
}
 
return success;
#else
int success;
char *e = a;
char *n = b;
 
success = FALSE;
 
#if defined ___NOCASE_FS___
StrUpr(e);
StrUpr(n);
#endif
 
// search for substring
success = strstr(e, n) != NULL;
 
return success;
#endif
}