From d7b120ab5cb34224c978ea2674b7c2b7517e3435 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Fri, 14 Oct 2016 14:22:32 -0700 Subject: [PATCH] added long commands --memory= and --memlimit-decompress= --- programs/zstdcli.c | 10 ++++++++++ tests/playTests.sh | 2 ++ 2 files changed, 12 insertions(+) diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 9a38ede7..da3786d6 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -281,6 +281,16 @@ int main(int argCount, const char* argv[]) memLimit = readU32FromChar(&argument); continue; } + if (!strncmp(argument, "--memory=", strlen("--memory="))) { + argument += strlen("--memory="); + memLimit = readU32FromChar(&argument); + continue; + } + if (!strncmp(argument, "--memlimit-decompress=", strlen("--memlimit-decompress="))) { + argument += strlen("--memlimit-decompress="); + memLimit = readU32FromChar(&argument); + continue; + } /* '-' means stdin/stdout */ if (!strcmp(argument, "-")){ diff --git a/tests/playTests.sh b/tests/playTests.sh index df9b167f..c5a58d62 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -84,6 +84,8 @@ $ZSTD -d - < tmp.zst > $INTOVOID $ECHO "test : impose memory limitation (must fail)" $ZSTD -d -f tmp.zst -M2K -c > $INTOVOID && die "decompression needs more memory than allowed" $ZSTD -d -f tmp.zst --memlimit=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command +$ZSTD -d -f tmp.zst --memory=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command +$ZSTD -d -f tmp.zst --memlimit-decompress=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command $ECHO "test : overwrite protection" $ZSTD -q tmp && die "overwrite check failed!" $ECHO "test : force overwrite"