diff --git a/contrib/adaptive-compression/multi.c b/contrib/adaptive-compression/multi.c index 5223d706..d88d3787 100644 --- a/contrib/adaptive-compression/multi.c +++ b/contrib/adaptive-compression/multi.c @@ -515,39 +515,35 @@ int main(int argCount, const char* argv[]) const char* argument = argv[argNum]; /* output filename designated with "-o" */ - if (argument[0]=='-') { - if (strlen(argument) > 1 && argument[1] == 'o') { - argument += 2; - outFilename = argument; - continue; - } - else if (strlen(argument) > 1 && argument[1] == 'v') { - g_displayLevel++; - continue; - } - else if (strlen(argument) > 1 && argument[1] == 'i') { - argument += 2; - g_compressionLevel = readU32FromChar(&argument); - DEBUGLOG(2, "g_compressionLevel: %u\n", g_compressionLevel); - continue; - } - else if (strlen(argument) > 1 && argument[1] == 's') { - g_displayStats = 1; - continue; - } - else if (strlen(argument) > 1 && argument[1] == 'h') { - help(); - return 0; - } - else if (strlen(argument) > 1 && argument[1] == 'p') { - g_useProgressBar = 1; - continue; - } - else { - DISPLAY("Error: invalid argument provided\n"); - ret = 1; - goto _main_exit; + if (argument[0]=='-' && strlen(argument) > 1) { + switch (argument[1]) { + case 'o': + argument += 2; + outFilename = argument; + break; + case 'v': + g_displayLevel++; + break; + case 'i': + argument += 2; + g_compressionLevel = readU32FromChar(&argument); + DEBUGLOG(2, "g_compressionLevel: %u\n", g_compressionLevel); + break; + case 's': + g_displayStats = 1; + break; + case 'h': + help(); + goto _main_exit; + case 'p': + g_useProgressBar = 1; + break; + default: + DISPLAY("Error: invalid argument provided\n"); + ret = 1; + goto _main_exit; } + continue; } /* regular files to be compressed */ diff --git a/contrib/adaptive-compression/run.sh b/contrib/adaptive-compression/run.sh index f030be55..bcd8c718 100755 --- a/contrib/adaptive-compression/run.sh +++ b/contrib/adaptive-compression/run.sh @@ -140,6 +140,9 @@ diff tests/test512.pdf tests/tmp512 diff tests/test1024.pdf tests/tmp1024 diff tests/test2048.pdf tests/tmp2048 +echo "Running Args Tests" +./multi -h +./multi -i22 -p -s -otmp.zst tests/test2048.pdf echo "finished with tests" make clean