[Toybox] [PATCH] Distinguish 32- and 64-bit variants in file(1) for x32.

Isaac Dunham ibid.ag at gmail.com
Sun Feb 28 17:10:41 PST 2016


On Sun, Feb 28, 2016 at 11:44:44AM -0600, Rob Landley wrote:
> On 02/28/2016 09:48 AM, enh wrote:
> > On Sat, Feb 27, 2016 at 10:51 PM, Rob Landley <rob at landley.net> wrote:
> >> Is there more than one implementation here, or are we just saying
> >> "everybody else uses darwinsys.com/file"?
> > 
> > as far as i know, there's only one. i've never come across another,
> > even on Mac OS.
> 
> Wikipedia[citation needed] says OpenBSD has its own, and that the
> original was from AT&T in the 70's.
> 
> https://en.wikipedia.org/wiki/File_(command)

Portable version of OpenBSD's at
https://github.com/brynet/file

FYI:
Everyone uses the same format for the magic file; magic.5 is the BSD
documentation, and magic.4 is the darwinsys version. The PDF version
(magic.5.pdf) may be helpful, or a website with the manpage:
https://github.com/brynet/file/raw/master/magic.5.pdf
http://linux.die.net/man/5/magic

However, darwinsys file also features a 'compiled' format.

The heirloom toolchest also has an implementation:
http://heirloom.cvs.sourceforge.net/viewvc/heirloom/heirloom/file/
This only looks at 512 bytes, so tends to be inaccurate.


There's also a very stale version without a magic file in v7/x86, but I
doubt you'll want to look at that.
Essentially it recognizes:
 {c,assembler,fortran} program text
 roff, nroff, or eqn input text
 troff output
 {commands,English,ascii} text
 {pure,separate,} executable
 archive
 old archive
 directory
 {char,block} special
 empty
 cannot open

HTH,
Isaac Dunham


 1456708241.0


More information about the Toybox mailing list