HuntnGather

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 26  →  ?path2? @ 27
/trunk/HuntnGather/Gather/Gather.c
@@ -6,7 +6,9 @@
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#if !defined ___AmigaOS___
#include <signal.h>
#endif
 
#include <sys/types.h>
#include <sys/stat.h>
@@ -96,7 +98,7 @@
#if defined ___AmigaOS___
return StrnCmp(locale, (STRPTR)*p, (STRPTR)*q, -1, SC_ASCII);
#else
return strncmp(*p, *q, strlen(*p));
return strcmp(*p, *q);
#endif
}
 
@@ -593,7 +595,7 @@
#if defined ___AmigaOS___
if(StrnCmp(locale, lines[i], rem, -1, SC_ASCII) == 0) {
#else
if(strncmp(lines[i], rem, strlen(rem)) == 0) {
if(strcmp(lines[i], rem) == 0) {
#endif
continue;
}
@@ -799,7 +801,6 @@
DIR *dir;
struct dirent *entry;
struct stat dirStat;
unsigned int size;
int i;
char *path;
char *subPath;
@@ -872,11 +873,10 @@
continue;
}
#endif
size = sizeof(path) + sizeof(entry->d_name) + 1;
switch(path[strlen(path) - 1]) {
case '/':
case ':': // This is a drive path.
if((subPath = malloc(size)) == NULL) {
if((subPath = malloc(sizeof(path) + sizeof(entry->d_name) + 1)) == NULL) {
fprintf(stderr, "Memory allocation failure.\n");
closedir(dir);
free(path);
@@ -891,7 +891,7 @@
sprintf(subPath, "%s%s", path, entry->d_name);
break;
default:
if((subPath = malloc(size + 1)) == NULL) {
if((subPath = malloc(sizeof(path) + sizeof(entry->d_name) + 1 + 1)) == NULL) {
fprintf(stderr, "Memory allocation failure.\n");
closedir(dir);
free(path);
@@ -1201,7 +1201,7 @@
#if defined ___AmigaOS___
if(min == NULL || StrnCmp(locale, tmp, min, -1, SC_ASCII) < 0) {
#else
if(min == NULL || strncmp(tmp, min, strlen(tmp)) < 0) {
if(min == NULL || strcmp(tmp, min) < 0) {
#endif
if(min != NULL) {
// Free previous instance.
@@ -1240,7 +1240,7 @@
#if defined ___AmigaOS___
if(StrnCmp(locale, min, rem, -1, SC_ASCII) == 0) {
#else
if(strncmp(min, rem, strlen(rem)) == 0 {
if(strcmp(min, rem) == 0 {
#endif
free(min);
continue;
@@ -1495,8 +1495,8 @@
fprintf(stdout, "SYNTAX: %s [-q] <-a|-r|-c> <PATH PATH PATH...> \n", name);
fprintf(stdout, " \n");
fprintf(stdout, "Required: \n");
fprintf(stdout, " -a [PATH...] Add files (default). \n");
fprintf(stdout, " -c [PATH...] Create database from scratch. \n");
fprintf(stdout, " -a [PATH...] Add files. \n");
fprintf(stdout, " -c [PATH...] Create from scratch. \n");
fprintf(stdout, " -r [PATH...] Remove files. \n");
fprintf(stdout, " \n");
fprintf(stdout, "Optional: \n");