aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2023-11-10 18:40:01 +0000
committerRob Landley <rob@landley.net>2023-11-10 13:50:38 -0600
commitcf63277fc064c4b566fa27869dadb3540a04f756 (patch)
treec0ae1958b0b8a9eacb91202bd1fea2c8a068ff3a
parentd2bada0e42e668ec65e1a853d32ac021feed4952 (diff)
downloadtoybox-cf63277fc064c4b566fa27869dadb3540a04f756.tar.gz
file: recognize wasm binary modules.
-rw-r--r--toys/posix/file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/toys/posix/file.c b/toys/posix/file.c
index cada80e1..1fdbefde 100644
--- a/toys/posix/file.c
+++ b/toys/posix/file.c
@@ -445,6 +445,10 @@ static void do_regular_file(int fd, char *name)
} else if (len>4 && !smemcmp(s, "ABX", 3)) {
xprintf("Android Binary XML v%d\n", s[3]);
+ // https://webassembly.github.io/spec/core/binary/modules.html#binary-module
+ } else if (len>8 && !smemcmp(s, "\0asm", 4)) {
+ xprintf("wasm binary module version %d\n", (int)peek_le(s+4, 4));
+
// Text files, including shell scripts.
} else {
char *what = 0;