aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/file.c
diff options
context:
space:
mode:
authorJoeky <joeky5888@gmail.com>2020-03-30 04:19:30 +0800
committerRob Landley <rob@landley.net>2020-03-29 20:46:09 -0500
commit3db8e5ea3066565bf70d3e1711818e3b3b5de273 (patch)
tree2039f0ddf4e7fcfe28b7f9e3a2c8c03f904499f8 /toys/posix/file.c
parent896fa846b1ec8cd4895f6320b56942f129e54bc9 (diff)
downloadtoybox-3db8e5ea3066565bf70d3e1711818e3b3b5de273.tar.gz
file: add 7z format
Diffstat (limited to 'toys/posix/file.c')
-rw-r--r--toys/posix/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/toys/posix/file.c b/toys/posix/file.c
index 4e84e1d4..a1de9168 100644
--- a/toys/posix/file.c
+++ b/toys/posix/file.c
@@ -264,6 +264,12 @@ static void do_regular_file(int fd, char *name)
xprintf("Zip archive data");
if (ver) xprintf(", requires at least v%d.%d to extract", ver/10, ver%10);
xputc('\n');
+ } else if (len>9 && strstart(&s, "7z\xbc\xaf\x27\x1c")) {
+ int ver = toybuf[6]*10+toybuf[7];
+
+ xprintf("7-zip archive data");
+ if (ver) xprintf(", version %d.%d", ver/10, ver%10);
+ xputc('\n');
} else if (len>4 && strstart(&s, "BZh") && isdigit(*s))
xprintf("bzip2 compressed data, block size = %c00k\n", *s);
else if (len > 31 && peek_be(s, 7) == 0xfd377a585a0000UL)