HuntnGather

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 4  →  ?path2? @ 5
/trunk/HuntnGather/Gather/Gather.c
@@ -16,10 +16,25 @@
 
#include "StringStack.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 "Q=Quiet/S,D=Database/K,P=Path/A/F"
#define OPT_QUIET 0
#define OPT_DATABASE 1
#define OPT_PATH 2
#define OPT_COUNT 3
LONG result[OPT_COUNT];
/*************************************************************************/
/* Version string used for querrying the program version. */
/*************************************************************************/
TEXT version_string[] =
"\0$VER: Gather 1.4 "__DATE__" by Wizardry and Steamworks";
#endif
 
#if !defined TRUE
#define TRUE 1;
@@ -32,12 +47,6 @@
#define MAX_MEM 262144
#define DEFAULT_DATABASE_FILE "S:gather.db"
 
/*************************************************************************/
/* Version string used for querrying the program version. */
/*************************************************************************/
TEXT version_string[] =
"\0$VER: Gather 1.3 "__DATE__" by Wizardry and Steamworks";
 
typedef struct {
unsigned int dirs;
unsigned int files;
@@ -641,6 +650,47 @@
* Main entry point.
*/
int main(int argc, char **argv) {
#if defined ___AmigaOS___
struct RDArgs *rdargs;
struct stat statPath;
UBYTE *dbFile;
UBYTE *argPath;
 
dbFile = DEFAULT_DATABASE_FILE;
argPath = 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];
}
 
if(result[OPT_QUIET]) {
verbose = FALSE;
}
 
argPath = (UBYTE *) result[OPT_PATH];
 
FreeArgs(rdargs);
FreeDosObject(DOS_RDARGS, rdargs);
}
 
stat(argPath, &statPath);
if(!S_ISDIR(statPath.st_mode)) {
fprintf(stderr, "Path '%s' is not a directory.\n", argPath);
return 1;
}
 
if(verbose) {
fprintf(stdout, "Gathering to database file: %s\n", dbFile);
}
 
Gather(dbFile, argPath);
#else
int option;
char *dbFile;
struct stat path;
@@ -674,7 +724,7 @@
 
stat(argv[optind], &path);
if(!S_ISDIR(path.st_mode)) {
fprintf(stderr, "%s is not a directory.\n", argv[optind]);
fprintf(stderr, "Path '%s' is not a directory.\n", argv[optind]);
return 1;
}
 
@@ -684,6 +734,7 @@
 
// Gather.
Gather(dbFile, argv[optind]);
#endif
 
return 0;
}