From: Arun Thomas Date: Fri, 10 Dec 2010 15:18:28 +0000 (+0000) Subject: file(1): Add ELF support X-Git-Tag: v3.2.0~720 X-Git-Url: http://zhaoyanbai.com/repos/doc/man.3.txt?a=commitdiff_plain;h=691030d5ce5babec22627c7a396dee9e9922306e;p=minix.git file(1): Add ELF support --- diff --git a/commands/file/file.c b/commands/file/file.c index 13df8a76f..858ecdb4d 100644 --- a/commands/file/file.c +++ b/commands/file/file.c @@ -1,3 +1,4 @@ + /* file - report on file type. Author: Andy Tanenbaum */ /* Magic number detection changed to look-up table 08-Jan-91 - ajm */ @@ -16,7 +17,7 @@ unsigned char buf[BLOCK_SIZE]; struct info { int execflag; /* 1 == ack executable, 2 == gnu executable, - * 3 == core */ + * 3 == core, 4 == elf executable */ unsigned char magic[4]; /* First four bytes of the magic number */ unsigned char mask[4]; /* Mask to apply when matching */ char *description; /* What it means */ @@ -57,6 +58,8 @@ struct info { "MINIX-68k gnu executable", 0x03, 0x82, 0x12, 0xC4, 0xC0, 0xff, 0xff, 0xff, 0xff, "core file", + 0x04, 0x7F, 0x45, 0x4C, 0x46, 0xff, 0xff, 0xff, 0xff, + "ELF executable", }; int tabsize = sizeof(table) / sizeof(struct info); @@ -268,6 +271,11 @@ int type; return; } + if (type == 4) { /* ELF executable */ + printf("\n"); + return; + } + printf("\n"); /* Not an executable file */ }