aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;