From 3db8e5ea3066565bf70d3e1711818e3b3b5de273 Mon Sep 17 00:00:00 2001 From: Joeky Date: Mon, 30 Mar 2020 04:19:30 +0800 Subject: file: add 7z format --- toys/posix/file.c | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- cgit v1.2.3