/trunk/HuntnGather/Hunt/Hunt.c |
@@ -12,8 +12,11 @@ |
#include <sys/types.h> |
#include <sys/stat.h> |
|
#if defined ___AmigaOS___ |
#include <proto/dos.h> |
#include <proto/exec.h> |
#include <proto/utility.h> |
#endif |
|
#if defined ___AsyncIO___ |
#include <asyncio.h> |
@@ -23,7 +26,7 @@ |
#include "getopt.h" |
#endif |
|
#define PROGRAM_VERSION "1.7.3" |
#define PROGRAM_VERSION "1.7.4" |
|
#if defined ___AmigaOS___ |
/*************************************************************************/ |
@@ -64,11 +67,6 @@ |
char *e = a; |
char *n = b; |
|
#if defined ___NOCASE_FS___ |
e = strupr(e); |
n = strupr(n); |
#endif |
|
// "must be at least 2 times as large plus 2 bytes" |
size = strlen(n) * 2 + 2; |
|
@@ -81,7 +79,11 @@ |
|
break; |
case 0: // no wildcards so fall back to exact name match |
success = (strstr(e, n) != NULL); |
#if defined ___NOCASE_FS___ |
success = Strnicmp(e, n, (LONG)strlen(n)) == 0; |
#else |
success = StrnCmp(e, n, (LONG)strlen(n)) == 0; |
#endif |
|
break; |
} |
@@ -102,7 +104,8 @@ |
n = strupr(n); |
#endif |
|
success = (strstr(e, n) != NULL); |
// search for substring |
success = strstr(e, n) != NULL; |
|
return success; |
#endif |
@@ -158,7 +161,7 @@ |
// Check if CTRL+C was pressed and abort the program. |
if(SetSignal(0L, SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) { |
run = FALSE; |
break; |
continue; |
} |
#endif |
|
@@ -197,7 +200,6 @@ |
name_size = 1.5 * name_size; |
name = realloc(name, name_size * sizeof(*name)); |
} |
//name = realloc(name, (i + 1 + 1) * sizeof(*name)); |
name[i] = c; |
name[i + 1] = '\0'; |
break; |
@@ -206,7 +208,6 @@ |
path_size = 1.5 * path_size; |
path = realloc(path, path_size * sizeof(*path)); |
} |
//path = realloc(path, (i + 1 + 1) * sizeof(*path)); |
path[i] = c; |
path[i + 1] = '\0'; |
break; |
@@ -258,7 +259,9 @@ |
struct stat path; |
|
// Bind handler to SIGINT. |
#if !defined ___AmigaOS___ |
signal(SIGINT, SignalHandler); |
#endif |
|
dbFile = DEFAULT_DATABASE_FILE; |
while((option = getopt(argc, argv, "hd:")) != -1) { |
@@ -282,7 +285,7 @@ |
|
stat(dbFile, &path); |
if(!S_ISREG(path.st_mode)) { |
fprintf(stderr, "Database file '%s' is not a file.\n", dbFile); |
fprintf(stderr, "'%s' is not a file.\n", dbFile); |
return 1; |
} |
|