/trunk/HuntnGather/Gather/Gather.c |
@@ -1007,8 +1007,8 @@ |
|
// Sort the temporary files. |
for(i = 0; i < tmpFiles; ++i) { |
tmpLines = CountFileLines(tmpNames[i]); |
SortDatabase(tmpNames[i], tmpLines); |
// Twice the number of computed lines required should cover the last file. |
SortDatabase(tmpNames[i], 2 * tmpLines); |
} |
|
// Merge all the temporary files to the database file. |
@@ -1112,24 +1112,24 @@ |
return 0; |
case '?': |
fprintf(stderr, "Invalid option %ct.\n", optopt); |
return 1; |
return 5; |
} |
} |
|
if(operation == NONE) { |
usage(argv[0]); |
return 1; |
return 5; |
} |
|
if(optind >= argc) { |
usage(argv[0]); |
return 1; |
return 5; |
} |
|
// Go through all supplied arguments and add paths to search. |
if((paths = malloc((argc - optind) * sizeof(*paths))) == NULL) { |
fprintf(stderr, "Memory allocation failure.\n"); |
return 1; |
return 20; |
} |
|
count = 0; |
@@ -1157,7 +1157,7 @@ |
// Add the path to the array of paths. |
if((paths[count] = malloc((strlen(path) + 1) * sizeof(*paths[count]))) == NULL) { |
fprintf(stderr, "Memory allocation failure."); |
return 1; |
return 20; |
} |
|
sprintf(paths[count], "%s", path); |
@@ -1170,7 +1170,7 @@ |
if(count == 0) { |
fprintf(stderr, "No valid paths are available.\n"); |
free(paths); |
return 1; |
return 5; |
} |
|
if(PROGRAM_VERBOSE) { |
@@ -1186,10 +1186,7 @@ |
if(PROGRAM_VERBOSE) { |
fprintf(stdout, "Removing '%s' and creating a new database.\n", dbFile); |
} |
if(RemoveFile(dbFile) == FALSE) { |
fprintf(stderr, "File '%s' could not be removed.\n", dbFile); |
break; |
} |
RemoveFile(dbFile); |
case GATHER: |
if(PROGRAM_VERBOSE) { |
fprintf(stdout, "Gathering files to database...\n"); |
@@ -1204,7 +1201,12 @@ |
break; |
default: |
fprintf(stderr, "Unknown operation.\n"); |
break; |
#if defined ___AmigaOS___ |
CloseLocale(locale); |
#endif |
|
free(paths); |
return 5; |
} |
|
#if defined ___AmigaOS___ |