If we can read and write bzip2 files, we should be able to identify them
too...
---
 toys/posix/file.c | 2 ++
 1 file changed, 2 insertions(+)
From 158d62fead6118a5fc9c1cbfa94fe2684ac5426e Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Wed, 15 Feb 2017 17:23:19 -0800
Subject: [PATCH] Teach file(1) about bzip2 files.

If we can read and write bzip2 files, we should be able to identify them
too...
---
 toys/posix/file.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/toys/posix/file.c b/toys/posix/file.c
index bab59e5..c7c72cd 100644
--- a/toys/posix/file.c
+++ b/toys/posix/file.c
@@ -249,6 +249,8 @@ static void do_regular_file(int fd, char *name, struct stat *sb)
     if (ver)
       xprintf(", requires at least v%d.%d to extract", 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 {
     char *what = 0;
     int i, bytes;
-- 
2.11.0.483.g087da7b7c-goog

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to