HuntnGather – Diff between revs 3 and 4

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 3 Rev 4
Line 31... Line 31...
31   31  
32 /*************************************************************************/ 32 /*************************************************************************/
33 /* Version string used for querrying the program version. */ 33 /* Version string used for querrying the program version. */
34 /*************************************************************************/ 34 /*************************************************************************/
35 TEXT version_string[] = 35 TEXT version_string[] =
Line 36... Line 36...
36 "\0$VER: Hunt 1.3 "__DATE__" by Wizardry and Steamworks"; 36 "\0$VER: Hunt 1.3.1 "__DATE__" by Wizardry and Steamworks";
Line 37... Line 37...
37   37  
38 int run = TRUE; 38 int run = TRUE;
Line 61... Line 61...
61 } 61 }
Line 62... Line 62...
62   62  
63 /* 63 /*
64 * Compare "name" and "needle" for equality. 64 * Compare "name" and "needle" for equality.
65 */ 65 */
66 int compare(char *name, char *needle) { 66 int compare(char *name, char *need) {
67 #if defined ___AmigaOS___ 67 #if defined ___AmigaOS___
68 ULONG size; 68 ULONG size;
69 char *upn, *upe; 69 char *upn, *upe;
70 int success; 70 int success;
Line 71... Line 71...
71 UBYTE *pattern; 71 UBYTE *pattern;
72   72  
Line 73... Line 73...
73 upe = strupr(needle); 73 upe = strupr(need);
Line 74... Line 74...
74 upn = strupr(name); 74 upn = strupr(name);
Line 75... Line 75...
75   75  
76 size = strlen(upe) * 3; 76 size = strlen(upe) * 3;
Line 77... Line 77...
77   77  
Line 78... Line 78...
78 if(pattern = AllocVec(size, MEMF_ANY|MEMF_CLEAR)) { 78 if(pattern = AllocVec(size, MEMF_ANY|MEMF_CLEAR)) {
79   79  
-   80 if(ParsePatternNoCase(upe, pattern, (LONG)size) > 0) {
-   81 success = MatchPatternNoCase(pattern, upn);
80 if(ParsePatternNoCase(upe, pattern, (LONG)size) >= 0) { 82  
Line -... Line 83...
-   83 FreeMem(pattern, size);
-   84  
-   85 return success;
81 success = MatchPatternNoCase(pattern, upn); 86 }
-   87  
82   88 FreeMem(pattern, size);
83 FreeMem(pattern, size); 89 }
84   90  
85 return success; 91 success = strstr(upn, upe) != NULL;
Line 86... Line 92...
86 } 92 free(upn);
87 } 93 free(upe);
88   94 return success;
89 return FALSE; 95  
90 #else 96 #else
91 return strstr(strupr(name), strupr(needle) != NULL; 97 return strstr(strupr(name), strupr(need)) != NULL;
92 #endif 98 #endif
93 } 99 }
94   100  
95   101  
Line 141... Line 147...
141 --side; 147 --side;
142 i = 0; 148 i = 0;
143 break; 149 break;
144 case '\t': 150 case '\t':
145 // Case insensitive match. 151 // Case insensitive match.
146 if(compare(name, needle)) { 152 if(compare(name, need)) {
147 match = TRUE; 153 match = TRUE;
148 } 154 }
149 if(path != NULL) { 155 if(path != NULL) {
150 free(path); 156 free(path);
151 path = (char *) malloc(sizeof(char)); 157 path = (char *) malloc(sizeof(char));
Line 179... Line 185...
179   185  
180 /* 186 /*
181 * 187 *
182 * Search the database for the matching string. 188 * Search the database for the matching string.
183 */ 189 */
184 void Hunt(char *dbFile, char *needle) { 190 void Hunt(char *dbFile, char *need) {
185 // Search the database for the matching string. 191 // Search the database for the matching string.
186 SearchDatabase(dbFile, needle); 192 SearchDatabase(dbFile, need);
Line 187... Line 193...
187 } 193 }
188   194  
189 int main(int argc, char **argv) { 195 int main(int argc, char **argv) {
Line 219... Line 225...
219 if(!S_ISREG(path.st_mode)) { 225 if(!S_ISREG(path.st_mode)) {
220 fprintf(stderr, "%s is not a file.\n", dbFile); 226 fprintf(stderr, "%s is not a file.\n", dbFile);
221 return 1; 227 return 1;
222 } 228 }
Line 223... Line 229...
223   229  
Line 224... Line 230...
224 Hunt("S:gather.db", argv[1]); 230 Hunt(dbFile, argv[optind]);
225   231