HuntnGather

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 4  →  ?path2? @ 5
/trunk/HuntnGather/Hunt/Hunt.c
@@ -15,10 +15,25 @@
#include <proto/dos.h>
#include <proto/exec.h>
 
#if defined ___AmigaOS___
#if !defined ___HAVE_GETOPT___
#include "getopt.h"
#endif
 
#if defined ___AmigaOS___
#include <dos/dos.h>
#include <dos/rdargs.h>
#define TEMPLATE "D=Database/K,P=Pattern/A/F"
#define OPT_DATABASE 0
#define OPT_PATTERN 1
#define OPT_COUNT 2
LONG result[OPT_COUNT];
/*************************************************************************/
/* Version string used for querrying the program version. */
/*************************************************************************/
TEXT version_string[] =
"\0$VER: Hunt 1.4 "__DATE__" by Wizardry and Steamworks";
#endif
 
#if !defined TRUE
#define TRUE 1;
#endif
@@ -29,12 +44,6 @@
 
#define DEFAULT_DATABASE_FILE "S:gather.db"
 
/*************************************************************************/
/* Version string used for querrying the program version. */
/*************************************************************************/
TEXT version_string[] =
"\0$VER: Hunt 1.3.1 "__DATE__" by Wizardry and Steamworks";
 
int run = TRUE;
 
void SignalHandler(int sig) {
@@ -193,6 +202,39 @@
}
 
int main(int argc, char **argv) {
#if defined ___AmigaOS___
struct RDArgs *rdargs;
struct stat statPath;
UBYTE *dbFile;
UBYTE *argPattern;
 
dbFile = DEFAULT_DATABASE_FILE;
argPattern = NULL;
if(rdargs = (struct RDArgs *) AllocDosObject(DOS_RDARGS, NULL)) {
if(ReadArgs(TEMPLATE, result, rdargs) == NULL) {
FreeArgs(rdargs);
FreeDosObject(DOS_RDARGS, rdargs);
return 1;
}
 
if(result[OPT_DATABASE] != NULL) {
dbFile = (UBYTE *) result[OPT_DATABASE];
}
 
argPattern = (UBYTE *) result[OPT_PATTERN];
 
FreeArgs(rdargs);
FreeDosObject(DOS_RDARGS, rdargs);
}
 
stat(dbFile, &statPath);
if(!S_ISREG(statPath.st_mode)) {
fprintf(stderr, "Database file '%s' is not a file.\n", dbFile);
return 1;
}
 
Hunt(dbFile, argPattern);
#else
int option;
char *dbFile;
struct stat path;
@@ -223,11 +265,12 @@
 
stat(dbFile, &path);
if(!S_ISREG(path.st_mode)) {
fprintf(stderr, "%s is not a file.\n", dbFile);
fprintf(stderr, "Database file '%s' is not a file.\n", dbFile);
return 1;
}
 
Hunt(dbFile, argv[optind]);
#endif
 
return 0;
}