]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed : cli : forgotten mandatory argument
authorYann Collet <cyan@fb.com>
Wed, 21 Sep 2016 14:05:03 +0000 (16:05 +0200)
committerYann Collet <cyan@fb.com>
Wed, 21 Sep 2016 14:05:03 +0000 (16:05 +0200)
programs/zstdcli.c
tests/playTests.sh

index 95267aa8917fa67b051932053a1ea066fd40bae8..412870e27dbd515bc4ccb9ae396d68d176935a74 100644 (file)
@@ -434,6 +434,8 @@ int main(int argCount, const char* argv[])
         filenameTable[filenameIdx++] = argument;
     }
 
+    if (lastCommand) { DISPLAY("error : command must be followed by argument \n"); return 1; }  /* forgotten argument */
+
     /* Welcome message (if verbose) */
     DISPLAYLEVEL(3, WELCOME_MESSAGE);
 
index 233f0775a18dd23d959ccbe9b32ef88538357ca2..d94d8fab9686ced66d81d9e841e59a7d58766a81 100755 (executable)
@@ -59,9 +59,12 @@ rm tmpCompressed
 $ZSTD tmp -o tmpCompressed
 ls tmpCompressed   # must work
 $ECHO "test : -o must be followed by filename (must fail)"
-$ZSTD tmp -of tmpCompressed && die "-o must be followed by filename"
+$ZSTD tmp -of tmpCompressed && die "-o must be followed by filename "
 $ECHO "test : force write, correct order"
 $ZSTD tmp -fo tmpCompressed
+$ECHO "test : forgotten argument"
+cp tmp tmp2
+$ZSTD tmp2 -fo && die "-o must be followed by filename "
 $ECHO "test : implied stdout when input is stdin"
 $ECHO bob | $ZSTD | $ZSTD -d
 $ECHO "test : null-length file roundtrip"