MCPcopy Create free account
hub / github.com/F-Stack/f-stack / FIO_listMultipleFiles

Function FIO_listMultipleFiles

freebsd/contrib/zstd/programs/fileio.c:3028–3080  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3026}
3027
3028int FIO_listMultipleFiles(unsigned numFiles, const char** filenameTable, int displayLevel)
3029{
3030 /* ensure no specified input is stdin (needs fseek() capability) */
3031 { unsigned u;
3032 for (u=0; u<numFiles;u++) {
3033 ERROR_IF(!strcmp (filenameTable[u], stdinmark),
3034 1, "zstd: --list does not support reading from standard input");
3035 } }
3036
3037 if (numFiles == 0) {
3038 if (!IS_CONSOLE(stdin)) {
3039 DISPLAYLEVEL(1, "zstd: --list does not support reading from standard input \n");
3040 }
3041 DISPLAYLEVEL(1, "No files given \n");
3042 return 1;
3043 }
3044
3045 if (displayLevel <= 2) {
3046 DISPLAYOUT("Frames Skips Compressed Uncompressed Ratio Check Filename\n");
3047 }
3048 { int error = 0;
3049 fileInfo_t total;
3050 memset(&total, 0, sizeof(total));
3051 total.usesCheck = 1;
3052 /* --list each file, and check for any error */
3053 { unsigned u;
3054 for (u=0; u<numFiles;u++) {
3055 error |= FIO_listFile(&total, filenameTable[u], displayLevel);
3056 } }
3057 if (numFiles > 1 && displayLevel <= 2) { /* display total */
3058 unsigned const unit = total.compressedSize < (1 MB) ? (1 KB) : (1 MB);
3059 const char* const unitStr = total.compressedSize < (1 MB) ? "KB" : "MB";
3060 double const compressedSizeUnit = (double)total.compressedSize / unit;
3061 double const decompressedSizeUnit = (double)total.decompressedSize / unit;
3062 double const ratio = (total.compressedSize == 0) ? 0 : ((double)total.decompressedSize)/total.compressedSize;
3063 const char* const checkString = (total.usesCheck ? "XXH64" : "");
3064 DISPLAYOUT("----------------------------------------------------------------- \n");
3065 if (total.decompUnavailable) {
3066 DISPLAYOUT("%6d %5d %7.2f %2s %5s %u files\n",
3067 total.numSkippableFrames + total.numActualFrames,
3068 total.numSkippableFrames,
3069 compressedSizeUnit, unitStr,
3070 checkString, (unsigned)total.nbFiles);
3071 } else {
3072 DISPLAYOUT("%6d %5d %7.2f %2s %9.2f %2s %5.3f %5s %u files\n",
3073 total.numSkippableFrames + total.numActualFrames,
3074 total.numSkippableFrames,
3075 compressedSizeUnit, unitStr, decompressedSizeUnit, unitStr,
3076 ratio, checkString, (unsigned)total.nbFiles);
3077 } }
3078 return error;
3079 }
3080}
3081
3082
3083#endif /* #ifndef ZSTD_NODECOMPRESS */

Callers 1

mainFunction · 0.85

Calls 4

strcmpFunction · 0.85
IS_CONSOLEFunction · 0.85
memsetFunction · 0.85
FIO_listFileFunction · 0.85

Tested by

no test coverage detected