aboutsummaryrefslogtreecommitdiffstats
path: root/community/zstd/allow-invoking-list-when-stdin-not-tty.patch
diff options
context:
space:
mode:
authorRoberto Oliveira <robertoguimaraes8@gmail.com>2018-06-30 17:49:23 +0000
committerRoberto Oliveira <robertoguimaraes8@gmail.com>2018-06-30 18:08:12 +0000
commitc645fdc26495e26936c8ad329986e6f6dee2e410 (patch)
tree9d6a676edd537d597235d9067b4cf34932ae07da /community/zstd/allow-invoking-list-when-stdin-not-tty.patch
parent9669e432d5efd5e507fc69419bc7c89fe9f68175 (diff)
downloadaports-c645fdc26495e26936c8ad329986e6f6dee2e410.tar.bz2
aports-c645fdc26495e26936c8ad329986e6f6dee2e410.tar.xz
community/ztd: upgrade to 1.3.5
Applied 2 upstream patches that fix a behavior when stdin is not a tty.
Diffstat (limited to 'community/zstd/allow-invoking-list-when-stdin-not-tty.patch')
-rw-r--r--community/zstd/allow-invoking-list-when-stdin-not-tty.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/community/zstd/allow-invoking-list-when-stdin-not-tty.patch b/community/zstd/allow-invoking-list-when-stdin-not-tty.patch
new file mode 100644
index 0000000000..47fa3e59a7
--- /dev/null
+++ b/community/zstd/allow-invoking-list-when-stdin-not-tty.patch
@@ -0,0 +1,67 @@
+From 712a9fd9721c314f4b0238577d803b012845f6d2 Mon Sep 17 00:00:00 2001
+From: "W. Felix Handte" <w@felixhandte.com>
+Date: Fri, 29 Jun 2018 15:33:44 -0400
+Subject: [PATCH] Allow Invoking `zstd --list` When `stdin` is not a `tty`
+
+Also now returns an error when no inputs are given.
+
+New proposed behavior:
+
+```
+felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l; echo $?
+No files given
+1
+felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l Makefile.zst; echo $?
+Frames Skips Compressed Uncompressed Ratio Check Filename
+ 1 0 3.08 KB 10.92 KB 3.544 XXH64 Makefile.zst
+0
+felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l <Makefile.zst; echo $?
+zstd: --list does not support reading from standard input
+No files given
+1
+felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l Makefile.zst <Makefile.zst; echo $?
+Frames Skips Compressed Uncompressed Ratio Check Filename
+ 1 0 3.08 KB 10.92 KB 3.544 XXH64 Makefile.zst
+0
+felix@odin:~/prog/zstd (list-stdin-check)$
+```
+---
+ programs/fileio.c | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/programs/fileio.c b/programs/fileio.c
+index 0175b3163..b4eed28d1 100644
+--- a/programs/fileio.c
++++ b/programs/fileio.c
+@@ -2017,21 +2017,25 @@ static int FIO_listFile(fileInfo_t* total, const char* inFileName, int displayLe
+ }
+
+ int FIO_listMultipleFiles(unsigned numFiles, const char** filenameTable, int displayLevel){
+-
+- if (!IS_CONSOLE(stdin)) {
+- DISPLAYOUT("zstd: --list does not support reading from standard input\n");
+- return 1;
++ unsigned u;
++ for (u=0; u<numFiles;u++) {
++ if (!strcmp (filenameTable[u], stdinmark)) {
++ DISPLAYOUT("zstd: --list does not support reading from standard input\n");
++ return 1;
++ }
+ }
+
+ if (numFiles == 0) {
++ if (!IS_CONSOLE(stdin)) {
++ DISPLAYOUT("zstd: --list does not support reading from standard input\n");
++ }
+ DISPLAYOUT("No files given\n");
+- return 0;
++ return 1;
+ }
+ if (displayLevel <= 2) {
+ DISPLAYOUT("Frames Skips Compressed Uncompressed Ratio Check Filename\n");
+ }
+ { int error = 0;
+- unsigned u;
+ fileInfo_t total;
+ memset(&total, 0, sizeof(total));
+ total.usesCheck = 1;