aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-08-23 16:26:07 -0700
committerRob Landley <rob@landley.net>2018-09-15 00:08:31 -0500
commitdf4e2efa6dc31f53901e3c90f172b669f7f8b78a (patch)
treea9a6ff4c2f2764acba0ae06920c35be9264da21e /toys/posix
parentd6c5f558eb822571472af0f2db38d6be853c06fd (diff)
downloadtoybox-df4e2efa6dc31f53901e3c90f172b669f7f8b78a.tar.gz
Add .bmp supoprt to file(1).
Diffstat (limited to 'toys/posix')
-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 552cd03f..4df0bc60 100644
--- a/toys/posix/file.c
+++ b/toys/posix/file.c
@@ -368,6 +368,12 @@ static void do_regular_file(int fd, char *name)
xprintf("(%s) ", name?name:"unknown");
}
xprintf("%s\n", (peek_le(s+magic+4, 2)==0x14c)?"x86":"x86-64");
+
+ // https://en.wikipedia.org/wiki/BMP_file_format
+ } else if (len > 0x32 && !memcmp(s, "BM", 2) && !memcmp(s+6, "\0\0\0\0", 4)) {
+ int w = peek_le(s+0x12,4), h = peek_le(s+0x16,4), bpp = peek_le(s+0x1c,2);
+
+ xprintf("BMP image, %d x %d, %d bpp, %s\n", w, h, bpp);
} else {
char *what = 0;
int i, bytes;