aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-09-13 14:35:43 -0700
committerRob Landley <rob@landley.net>2016-09-13 17:16:37 -0500
commit6783156813d6c1c8469a7535f3cb575a776ceaa6 (patch)
tree9673b60805cfeede0e82fb26080b70ead251e2db /toys
parent493dc573825a862ee533c8aaf91ab23112b591c2 (diff)
downloadtoybox-6783156813d6c1c8469a7535f3cb575a776ceaa6.tar.gz
Add ar archive support to file.
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/file.c3
1 files changed, 1 insertions, 2 deletions
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, "!<arch>\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);