HuntnGather – Diff between revs 5 and 8

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 5 Rev 8
Line 18... Line 18...
18 #if !defined ___HAVE_GETOPT___ 18 #if !defined ___HAVE_GETOPT___
19 #include "getopt.h" 19 #include "getopt.h"
20 #endif 20 #endif
Line 21... Line 21...
21   21  
22 #if defined ___AmigaOS___ -  
23 #include <dos/dos.h> -  
24 #include <dos/rdargs.h> -  
25 #define TEMPLATE "D=Database/K,P=Pattern/A/F" -  
26 #define OPT_DATABASE 0 -  
27 #define OPT_PATTERN 1 -  
28 #define OPT_COUNT 2 -  
29 LONG result[OPT_COUNT]; 22 #if defined ___AmigaOS___
30 /*************************************************************************/ 23 /*************************************************************************/
31 /* Version string used for querrying the program version. */ 24 /* Version string used for querrying the program version. */
32 /*************************************************************************/ 25 /*************************************************************************/
33 TEXT version_string[] = 26 TEXT version_string[] =
34 "\0$VER: Hunt 1.4 "__DATE__" by Wizardry and Steamworks"; 27 "\0$VER: Hunt 1.5 "__DATE__" by Wizardry and Steamworks";
Line 35... Line 28...
35 #endif 28 #endif
36   29  
37 #if !defined TRUE 30 #if !defined TRUE
Line 200... Line 193...
200 // Search the database for the matching string. 193 // Search the database for the matching string.
201 SearchDatabase(dbFile, need); 194 SearchDatabase(dbFile, need);
202 } 195 }
Line 203... Line 196...
203   196  
204 int main(int argc, char **argv) { -  
205 #if defined ___AmigaOS___ -  
206 struct RDArgs *rdargs; -  
207 struct stat statPath; -  
208 UBYTE *dbFile; -  
209 UBYTE *argPattern; -  
210   -  
211 dbFile = DEFAULT_DATABASE_FILE; -  
212 argPattern = NULL; -  
213 if(rdargs = (struct RDArgs *) AllocDosObject(DOS_RDARGS, NULL)) { -  
214 if(ReadArgs(TEMPLATE, result, rdargs) == NULL) { -  
215 FreeArgs(rdargs); -  
216 FreeDosObject(DOS_RDARGS, rdargs); -  
217 return 1; -  
218 } -  
219   -  
220 if(result[OPT_DATABASE] != NULL) { -  
221 dbFile = (UBYTE *) result[OPT_DATABASE]; -  
222 } -  
223   -  
224 argPattern = (UBYTE *) result[OPT_PATTERN]; -  
225   -  
226 FreeArgs(rdargs); -  
227 FreeDosObject(DOS_RDARGS, rdargs); -  
228 } -  
229   -  
230 stat(dbFile, &statPath); -  
231 if(!S_ISREG(statPath.st_mode)) { -  
232 fprintf(stderr, "Database file '%s' is not a file.\n", dbFile); -  
233 return 1; -  
234 } -  
235   -  
236 Hunt(dbFile, argPattern); -  
237 #else 197 int main(int argc, char **argv) {
238 int option; 198 int option;
239 char *dbFile; 199 char *dbFile;
Line 240... Line 200...
240 struct stat path; 200 struct stat path;
Line 248... Line 208...
248 case 'd': 208 case 'd':
249 dbFile = optarg; 209 dbFile = optarg;
250 break; 210 break;
251 case 'h': 211 case 'h':
252 fprintf(stdout, "SYNTAX: %s [-d DATABASE] PATTERN\n", argv[0]); 212 fprintf(stdout, "SYNTAX: %s [-d DATABASE] PATTERN\n", argv[0]);
253 break; 213 return 0;
254 case '?': 214 case '?':
255 fprintf(stderr, "Invalid option %c.\n", optopt); 215 fprintf(stderr, "Invalid option %c.\n", optopt);
256 fprintf(stdout, "SYNTAX: %s [-d DATABASE] PATTERN\n", argv[0]); 216 fprintf(stdout, "SYNTAX: %s [-d DATABASE] PATTERN\n", argv[0]);
257 return 1; 217 return 1;
258 } 218 }
Line 268... Line 228...
268 fprintf(stderr, "Database file '%s' is not a file.\n", dbFile); 228 fprintf(stderr, "Database file '%s' is not a file.\n", dbFile);
269 return 1; 229 return 1;
270 } 230 }
Line 271... Line 231...
271   231  
272 Hunt(dbFile, argv[optind]); -  
Line 273... Line 232...
273 #endif 232 Hunt(dbFile, argv[optind]);
274   233