summaryrefslogtreecommitdiffstats
path: root/common/filetype.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-04-13 14:04:40 +0800
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-04-18 19:53:08 +0800
commit733d85510c74d9638dc88e001f45412f30a2f3d0 (patch)
treeabb147da4a893592f81c7f469a99ead10538349c /common/filetype.c
parenta2d2e8868fe3c963ebac634b695ae18bb4b411ca (diff)
downloadbarebox-733d85510c74d9638dc88e001f45412f30a2f3d0.tar.gz
filetype: add Bourne Shell support
Put it at first as it's the most likely to detect Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'common/filetype.c')
-rw-r--r--common/filetype.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 0120913..15a3732 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -38,6 +38,7 @@ static const char *filetype_str[] = {
[filetype_bzip2] = "bzip2 compressed",
[filetype_oftree] = "open firmware flat device tree",
[filetype_aimage] = "Android boot image",
+ [filetype_sh] = "Bourne Shell",
};
const char *file_type_to_string(enum filetype f)
@@ -53,6 +54,8 @@ enum filetype file_detect_type(void *_buf)
u32 *buf = _buf;
u8 *buf8 = _buf;
+ if (strncmp(buf8, "#!/bin/sh", 9) == 0)
+ return filetype_sh;
if (buf[8] == 0x65726162 && buf[9] == 0x00786f62)
return filetype_arm_barebox;
if (buf[9] == 0x016f2818 || buf[9] == 0x18286f01)