From 1ad8ac7a1d8a2c69903a380a499140d5f585be08 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Wed, 6 Dec 2017 09:53:10 +0000 Subject: [PATCH] Revert local changes made to make zstd(1) frontend behave like gzip(1) and friends This change was made to allow zstd(1) to be a dropin replacement for gzip(1) and friends, allowing easy integration, in particular with newsyslog(8). At the price of having a zstd(1) command which by default behaves differently than what upstream default, confusing users. newsyslog(8) has been adapted to now be more flexible in what it accepts as compression program, so we can switch back zstd(1) to its default behaviour Reported by: many --- sys/contrib/zstd/programs/fileio.c | 2 +- sys/contrib/zstd/programs/zstdcli.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/contrib/zstd/programs/fileio.c b/sys/contrib/zstd/programs/fileio.c index dedea009a941..70158f930952 100644 --- a/sys/contrib/zstd/programs/fileio.c +++ b/sys/contrib/zstd/programs/fileio.c @@ -203,7 +203,7 @@ static U32 g_dictIDFlag = 1; void FIO_setDictIDFlag(unsigned dictIDFlag) { g_dictIDFlag = dictIDFlag; } static U32 g_checksumFlag = 1; void FIO_setChecksumFlag(unsigned checksumFlag) { g_checksumFlag = checksumFlag; } -static U32 g_removeSrcFile = 1; +static U32 g_removeSrcFile = 0; void FIO_setRemoveSrcFile(unsigned flag) { g_removeSrcFile = (flag>0); } static U32 g_memLimit = 0; void FIO_setMemLimit(unsigned memLimit) { g_memLimit = memLimit; } diff --git a/sys/contrib/zstd/programs/zstdcli.c b/sys/contrib/zstd/programs/zstdcli.c index d3c373c8ddd0..3f8367341885 100644 --- a/sys/contrib/zstd/programs/zstdcli.c +++ b/sys/contrib/zstd/programs/zstdcli.c @@ -68,7 +68,7 @@ #define MB *(1 <<20) #define GB *(1U<<30) -#define DISPLAY_LEVEL_DEFAULT 1 +#define DISPLAY_LEVEL_DEFAULT 2 static const char* g_defaultDictName = "dictionary"; static const unsigned g_defaultMaxDictSize = 110 KB; @@ -421,7 +421,7 @@ int main(int argCount, const char* argv[]) /* preset behaviors */ if (exeNameMatch(programName, ZSTD_ZSTDMT)) nbThreads=0; if (exeNameMatch(programName, ZSTD_UNZSTD)) operation=zom_decompress; - if (exeNameMatch(programName, ZSTD_CAT)) { operation=zom_decompress; forceStdout=1; FIO_overwriteMode(); outFileName=stdoutmark; g_displayLevel=1; FIO_setRemoveSrcFile(0); } + if (exeNameMatch(programName, ZSTD_CAT)) { operation=zom_decompress; forceStdout=1; FIO_overwriteMode(); outFileName=stdoutmark; g_displayLevel=1; } if (exeNameMatch(programName, ZSTD_GZ)) { suffix = GZ_EXTENSION; FIO_setCompressionType(FIO_gzipCompression); FIO_setRemoveSrcFile(1); } /* behave like gzip */ if (exeNameMatch(programName, ZSTD_GUNZIP)) { operation=zom_decompress; FIO_setRemoveSrcFile(1); } /* behave like gunzip */ if (exeNameMatch(programName, ZSTD_GZCAT)) { operation=zom_decompress; forceStdout=1; FIO_overwriteMode(); outFileName=stdoutmark; g_displayLevel=1; } /* behave like gzcat */