]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
preset behavior for gzip, gunzip and gzcat
authorYann Collet <cyan@fb.com>
Tue, 14 Feb 2017 18:45:19 +0000 (10:45 -0800)
committerYann Collet <cyan@fb.com>
Tue, 14 Feb 2017 18:45:19 +0000 (10:45 -0800)
when zstd is called through a link named gzip, gunzip or gzcat,
provides the same behavior as the related program.
gzip compresses using --format=gz
both gzip and gunzip enable --rm by default

NEWS
programs/zstdcli.c

diff --git a/NEWS b/NEWS
index 09f1d010d2e58fb4d3f88c65204358a6fd742de3..a710da8b96f1b9091a05d280f2b4000d7444025a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,9 @@
 v1.1.4
-cli : new : advanced comnmand --priority=rt, by Przemyslaw Skibinski
+cli : new : can compress in *.gz format, using --format=gzip command, by Przemyslaw Skibinski
+cli : new : advanced benchmark command --priority=rt
 cli : fix : write on sparse-enabled file systems in 32-bits mode, by @ds77
 API : new : ZSTD_getFrameCompressedSize(), ZSTD_getFrameContentSize(), ZSTD_findDecompressedSize(), by Sean Purcell
-API : change : ZSTD_compress*() with srcSize==0 create an empty-frame of known size, by Sean Purcell
+API : change : ZSTD_compress*() with srcSize==0 create an empty-frame of known size
 doc : new : educational decoder, by Sean Purcell
 
 v1.1.3
index 33c0cd8d523158fd6a7b790d39b7939cf6ce49dd..588111913d3bcaecc2782b391d9c223dda1c0a51 100644 (file)
 
 #define GZ_EXTENSION ".gz"
 #define ZSTD_EXTENSION ".zst"
-#define ZSTD_CAT "zstdcat"
 #define ZSTD_UNZSTD "unzstd"
+#define ZSTD_CAT "zstdcat"
+#define ZSTD_GZ "gzip"
+#define ZSTD_GUNZIP "gunzip"
+#define ZSTD_GZCAT "gzcat"
 
 #define KB *(1 <<10)
 #define MB *(1 <<20)
@@ -319,6 +322,9 @@ int main(int argCount, const char* argv[])
     /* preset behaviors */
     if (!strcmp(programName, ZSTD_UNZSTD)) operation=zom_decompress;
     if (!strcmp(programName, ZSTD_CAT)) { operation=zom_decompress; forceStdout=1; FIO_overwriteMode(); outFileName=stdoutmark; displayLevel=1; }
+    if (!strcmp(programName, ZSTD_GZ)) { suffix = GZ_EXTENSION; FIO_setCompressionType(FIO_gzipCompression); FIO_setRemoveSrcFile(1); }    /* behave like gzip */
+    if (!strcmp(programName, ZSTD_GUNZIP)) { operation=zom_decompress; FIO_setRemoveSrcFile(1); }                                          /* behave like gunzip */
+    if (!strcmp(programName, ZSTD_GZCAT)) { operation=zom_decompress; forceStdout=1; FIO_overwriteMode(); outFileName=stdoutmark; displayLevel=1; }  /* behave like gzcat */
     memset(&compressionParams, 0, sizeof(compressionParams));
 
     /* command switches */