moved signifcant operations to fileio.c

This commit is contained in:
Paul Cruz 2017-06-20 12:43:10 -07:00
parent c594507871
commit bda57754a2
3 changed files with 24 additions and 19 deletions

View File

@ -1032,7 +1032,8 @@ static void displayInfo(const char* inFileName, fileInfo_t* info, int displayLev
}
}
int FIO_listFile(const char* inFileName, int displayLevel){
static int FIO_listFile(const char* inFileName, int displayLevel){
/* initialize info to avoid warnings */
fileInfo_t info;
memset(&info, 0, sizeof(info));
@ -1055,6 +1056,25 @@ int FIO_listFile(const char* inFileName, int displayLevel){
}
}
int FIO_listMultipleFiles(unsigned numFiles, const char** filenameTable, int displayLevel){
if (numFiles == 0) {
DISPLAYOUT("No files given\n");
return 0;
}
DISPLAYOUT("===========================================\n");
DISPLAYOUT("Printing information about compressed files\n");
DISPLAYOUT("===========================================\n");
DISPLAYOUT("Number of files listed: %u\n", numFiles);
{
int error = 0;
unsigned u;
for (u=0; u<numFiles;u++) {
error |= FIO_listFile(filenameTable[u], displayLevel);
}
return error;
}
}
int FIO_compressMultipleFilenames(const char** inFileNamesTable, unsigned nbFiles,
const char* suffix,
const char* dictFileName, int compressionLevel,

View File

@ -70,7 +70,7 @@ int FIO_compressFilename (const char* outfilename, const char* infilename, const
@return : 0 == ok; 1 == pb with src file. */
int FIO_decompressFilename (const char* outfilename, const char* infilename, const char* dictFileName);
int FIO_listFile(const char* infilename, int displayLevel);
int FIO_listMultipleFiles(unsigned numFiles, const char** filenameTable, int displayLevel);
/*-*************************************
* Multiple File functions

View File

@ -676,23 +676,8 @@ int main(int argCount, const char* argv[])
}
#endif
if (operation == zom_list) {
g_displayOut = stdout;
if(filenameIdx==0){
DISPLAY("No files given\n");
CLEAN_RETURN(0);
}
DISPLAY("===========================================\n");
DISPLAY("Printing information about compressed files\n");
DISPLAY("===========================================\n");
DISPLAY("Number of files listed: %d\n", filenameIdx);
{
int error = 0;
unsigned u;
for (u=0; u<filenameIdx;u++) {
error |= FIO_listFile(filenameTable[u], g_displayLevel);
}
CLEAN_RETURN(error);
}
int const ret = FIO_listMultipleFiles(filenameIdx, filenameTable, g_displayLevel);
CLEAN_RETURN(ret);
}
/* Check if benchmark is selected */
if (operation==zom_bench) {