From 14a2ca0fd8bb881d7089b7c4f6c805d9ef16fcf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Ant=C3=B4nio?= Date: Tue, 25 Oct 2022 22:09:27 -0300 Subject: [PATCH] tar.c: Added support for zstd archives. Kudos to @tch69! --- tar/tar.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tar/tar.c b/tar/tar.c index e43b47a..00276d0 100644 --- a/tar/tar.c +++ b/tar/tar.c @@ -2745,9 +2745,14 @@ checkzip(const char *bp, int rd) return redirect("lzip", "-cd", rd); else if (bp[0] == '\37' && bp[1] == '\213') return redirect("gzip", "-cd", rd); - else if (bp[0] == '\xFD'&& bp[2] == '7' && bp[3] == 'z' && bp[4] == 'X' && bp[5] == 'Z'); + else if (bp[0] == '\xFD'&& bp[2] == '7' && bp[3] == 'z' && bp[4] == 'X' && bp[5] == 'Z') return redirect("xz", "-cd", rd); - } + else if (bp[0] == '\x28' && bp[1] == '\xB5' && bp[2] == '\x2F' && bp[3] == '\xFD'); + return redirect("zstd", "-cd", rd); + // else; + // fprintf(stderr, "%s: file damaged or not tar archive\n", progname); + // done(-1); + } maybezip = 0; return -1; }