/trunk/HuntnGather/Hunt/Hunt.c/Hunt.c |
@@ -33,7 +33,7 @@ |
/* Version string used for querrying the program version. */ |
/*************************************************************************/ |
TEXT version_string[] = |
"\0$VER: Hunt 1.3 "__DATE__" by Wizardry and Steamworks"; |
"\0$VER: Hunt 1.3.1 "__DATE__" by Wizardry and Steamworks"; |
|
int run = TRUE; |
|
@@ -63,7 +63,7 @@ |
/* |
* Compare "name" and "needle" for equality. |
*/ |
int compare(char *name, char *needle) { |
int compare(char *name, char *need) { |
#if defined ___AmigaOS___ |
ULONG size; |
char *upn, *upe; |
@@ -70,7 +70,7 @@ |
int success; |
UBYTE *pattern; |
|
upe = strupr(needle); |
upe = strupr(need); |
upn = strupr(name); |
|
size = strlen(upe) * 3; |
@@ -77,7 +77,7 @@ |
|
if(pattern = AllocVec(size, MEMF_ANY|MEMF_CLEAR)) { |
|
if(ParsePatternNoCase(upe, pattern, (LONG)size) >= 0) { |
if(ParsePatternNoCase(upe, pattern, (LONG)size) > 0) { |
success = MatchPatternNoCase(pattern, upn); |
|
FreeMem(pattern, size); |
@@ -84,11 +84,17 @@ |
|
return success; |
} |
|
FreeMem(pattern, size); |
} |
|
return FALSE; |
success = strstr(upn, upe) != NULL; |
free(upn); |
free(upe); |
return success; |
|
#else |
return strstr(strupr(name), strupr(needle) != NULL; |
return strstr(strupr(name), strupr(need)) != NULL; |
#endif |
} |
|
@@ -97,7 +103,7 @@ |
* |
* Search the database for a matching string. |
*/ |
void SearchDatabase(char *dbFile, char* needle) { |
void SearchDatabase(char *dbFile, char* need) { |
FILE *fp; |
char *name; |
char *path; |
@@ -143,7 +149,7 @@ |
break; |
case '\t': |
// Case insensitive match. |
if(compare(name, needle)) { |
if(compare(name, need)) { |
match = TRUE; |
} |
if(path != NULL) { |
@@ -181,9 +187,9 @@ |
* |
* Search the database for the matching string. |
*/ |
void Hunt(char *dbFile, char *needle) { |
void Hunt(char *dbFile, char *need) { |
// Search the database for the matching string. |
SearchDatabase(dbFile, needle); |
SearchDatabase(dbFile, need); |
} |
|
int main(int argc, char **argv) { |
@@ -221,7 +227,7 @@ |
return 1; |
} |
|
Hunt("S:gather.db", argv[1]); |
Hunt(dbFile, argv[optind]); |
|
return 0; |
} |