]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
setup basic functions for adding --list functionality
authorPaul Cruz <paulcruz74@fb.com>
Mon, 5 Jun 2017 21:45:31 +0000 (14:45 -0700)
committerPaul Cruz <paulcruz74@fb.com>
Mon, 5 Jun 2017 21:45:31 +0000 (14:45 -0700)
programs/fileio.c
programs/fileio.h
programs/zstdcli.c

index 44152b0b128f3fa668fc82e1391b6ccdca9c56ab..466faf38556b955ac6eb4bd2fb841afca326c272 100644 (file)
@@ -862,6 +862,11 @@ int FIO_compressFilename(const char* dstFileName, const char* srcFileName,
     return result;
 }
 
+int FIO_listFile(const char* infilename){
+    DISPLAY("FILE DETECTED: %s\n", infilename);
+    DISPLAY("working\n"); 
+    return 0;
+}
 
 int FIO_compressMultipleFilenames(const char** inFileNamesTable, unsigned nbFiles,
                                   const char* suffix,
index 65da98d7fa88aaf8c4be7913634070ee9c8acf65..4ca1a2b38a532a64b56a19069bc1c3d14e6a08d7 100644 (file)
@@ -70,6 +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);
 
 /*-*************************************
 *  Multiple File functions
index 32fef99930e91f87e29bec68add1c9bb5f5148ad..be0a447bbe230fe5ff62bdddf62321e5342b7d91 100644 (file)
@@ -117,6 +117,7 @@ static int usage_advanced(const char* programName)
     DISPLAY( " -v     : verbose mode; specify multiple times to increase verbosity\n");
     DISPLAY( " -q     : suppress warnings; specify twice to suppress errors too\n");
     DISPLAY( " -c     : force write to standard output, even if it is the console\n");
+    DISPLAY( " -l     : print information about zstd compressed files.\n");
 #ifndef ZSTD_NOCOMPRESS
     DISPLAY( "--ultra : enable levels beyond %i, up to %i (requires more memory)\n", ZSTDCLI_CLEVEL_MAX, ZSTD_maxCLevel());
 #ifdef ZSTD_MULTITHREAD
@@ -310,7 +311,7 @@ static unsigned parseCompressionParameters(const char* stringPtr, ZSTD_compressi
 }
 
 
-typedef enum { zom_compress, zom_decompress, zom_test, zom_bench, zom_train } zstd_operation_mode;
+typedef enum { zom_compress, zom_decompress, zom_test, zom_bench, zom_train, zom_list } zstd_operation_mode;
 
 #define CLEAN_RETURN(i) { operationResult = (i); goto _end; }
 
@@ -531,7 +532,7 @@ int main(int argCount, const char* argv[])
                         argument++;
                         memLimit = readU32FromChar(&argument);
                         break;
-
+                    case 'l': operation=zom_list; argument++; break;
 #ifdef UTIL_HAS_CREATEFILELIST
                         /* recursive */
                     case 'r': recursive=1; argument++; break;
@@ -672,7 +673,17 @@ int main(int argCount, const char* argv[])
         }
     }
 #endif
-
+    if(operation==zom_list){
+        DISPLAY("===========================================\n"); 
+        DISPLAY("Printing information about compressed files\n");
+        DISPLAY("===========================================\n"); 
+        unsigned u;
+        DISPLAY("Number of files listed: %d\n", filenameIdx);
+        for(u=0; u<filenameIdx;u++){
+            FIO_listFile(filenameTable[u]);             
+        }
+        CLEAN_RETURN(0);
+    }
     /* Check if benchmark is selected */
     if (operation==zom_bench) {
 #ifndef ZSTD_NOBENCH