moved main logic for job creation into a separate function

This commit is contained in:
Paul Cruz 2017-07-05 10:48:04 -07:00
parent 9ccd55f3a8
commit dd8a591d5d

View File

@ -260,15 +260,8 @@ static int createCompressionJob(adaptCCtx* ctx, BYTE* data, size_t srcSize)
return 0;
}
/* return 0 if successful, else return error */
int main(int argCount, const char* argv[])
static int compressFilename(const char* const srcFilename, const char* const dstFilename)
{
if (argCount < 3) {
DISPLAY("Error: not enough arguments\n");
return 1;
}
const char* const srcFilename = argv[1];
const char* const dstFilename = argv[2];
BYTE* const src = malloc(FILE_CHUNK_SIZE);
FILE* const srcFile = fopen(srcFilename, "rb");
size_t fileSize = getFileSize(srcFilename);
@ -346,3 +339,13 @@ cleanup:
free(src);
return ret;
}
/* return 0 if successful, else return error */
int main(int argCount, const char* argv[])
{
if (argCount < 3) {
DISPLAY("Error: not enough arguments\n");
return 1;
}
return compressFilename(argv[1], argv[2]);
}