diff options
-rwxr-xr-x | tests/file.test | 2 | ||||
-rw-r--r-- | toys/posix/file.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/file.test b/tests/file.test index 90acfa4c..7cf84981 100755 --- a/tests/file.test +++ b/tests/file.test @@ -36,7 +36,7 @@ testing "7z file" "file $FILES/tar/tar.7z | sed 's|$FILES/||'" \ testing "zip file" "file $FILES/zip/example.zip | sed 's|$FILES/||'" \ "zip/example.zip: Zip archive data, requires at least v1.0 to extract\n" "" "" echo R0lGODlhIAAgAMZHAAAAABYWFiYmJioqKi4uLjIy | base64 -d > gif -testing "gif file" "file gif" "gif: GIF image data, 32 x 32\n" "" "" +testing "gif file" "file gif" "gif: GIF image data, version 89a, 32 x 32\n" "" "" rm -f gif # TODO: check in a genuine minimal .dex diff --git a/toys/posix/file.c b/toys/posix/file.c index 6fa51102..5ec24919 100644 --- a/toys/posix/file.c +++ b/toys/posix/file.c @@ -225,8 +225,8 @@ static void do_regular_file(int fd, char *name) // https://www.w3.org/Graphics/GIF/spec-gif89a.txt } else if (len>16 && (strstart(&s, "GIF87a") || strstart(&s, "GIF89a"))) - xprintf("GIF image data, %d x %d\n", - (int)peek_le(s, 2), (int)peek_le(s+2, 2)); + xprintf("GIF image data, version %3.3s, %d x %d\n", + s-3, (int)peek_le(s, 2), (int)peek_le(s+2, 2)); // TODO: parsing JPEG for width/height is harder than GIF or PNG. else if (len>32 && !memcmp(toybuf, "\xff\xd8", 2)) xputs("JPEG image data"); |