From d1c664a31b656c1541c79044aa44467420f78f14 Mon Sep 17 00:00:00 2001
From: Rob Landley <rob@landley.net>
Date: Mon, 3 Apr 2017 15:48:21 -0500
Subject: Add gzip support. (Doesn't show source OS and timestamp, but
 reporting them isn't obviously useful.)

---
 toys/posix/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'toys')

diff --git a/toys/posix/file.c b/toys/posix/file.c
index c7c72cd1..e52e884f 100644
--- a/toys/posix/file.c
+++ b/toys/posix/file.c
@@ -251,7 +251,8 @@ static void do_regular_file(int fd, char *name, struct stat *sb)
     xputc('\n');
   } else if (len>4 && strstart(&s, "BZh") && isdigit(*s)) {
     xprintf("bzip2 compressed data, block size = %c00k\n", *s);
-  } else {
+  } else if (len>10 && strstart(&s, "\x1f\x8b")) xputs("gzip compressed data");
+  else {
     char *what = 0;
     int i, bytes;
 
-- 
cgit v1.2.3