From 6783156813d6c1c8469a7535f3cb575a776ceaa6 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 13 Sep 2016 14:35:43 -0700 Subject: Add ar archive support to file. --- toys/posix/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'toys/posix/file.c') diff --git a/toys/posix/file.c b/toys/posix/file.c index 335c67ce..4827f8f5 100644 --- a/toys/posix/file.c +++ b/toys/posix/file.c @@ -3,8 +3,6 @@ * Copyright 2016 The Android Open Source Project * * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/file.html - * - * TODO: ar USE_FILE(NEWTOY(file, "<1hL[!hL]", TOYFLAG_USR|TOYFLAG_BIN)) @@ -179,6 +177,7 @@ static void do_regular_file(int fd, char *name, struct stat *sb) if (len<0) perror_msg("%s", name); if (len>40 && strstart(&s, "\177ELF")) do_elf_file(fd, sb); + else if (len>=8 && strstart(&s, "!\n")) xprintf("ar archive\n"); else if (len>28 && strstart(&s, "\x89PNG\x0d\x0a\x1a\x0a")) { // PNG is big-endian: https://www.w3.org/TR/PNG/#7Integers-and-byte-order int chunk_length = peek_be(s, 4); -- cgit v1.2.3