Merge branch 'vendor/BINUTILS220'
[dragonfly.git] / contrib / file / README
1 ** README for file(1) Command **
2 @(#) $File: README,v 1.44 2011/03/24 13:03:39 rrt Exp $
3
4 Mailing List: file@mx.gw.com
5 Bug tracker: http://bugs.gw.com/
6 E-mail: christos@astron.com
7
8 Phone: Do not even think of telephoning me about this program. Send cash first!
9
10 This is Release 5.x of Ian Darwin's (copyright but distributable)
11 file(1) command, an implementation of the Unix File(1) command.
12 It knows the 'magic number' of several thousands of file types.
13 This version is the standard "file" command for Linux,
14 *BSD, and other systems. (See "patchlevel.h" for the exact release number).
15
16 You can download the latest version of file from:
17
18         ftp://ftp.astron.com/pub/file/
19
20 A public read-only git repository is available at:
21
22         https://github.com/glensc/file
23
24 The major changes for 5.x are CDF file parsing, indirect magic, and
25 overhaul in mime and ascii encoding handling.
26
27 The major feature of 4.x is the refactoring of the code into a library,
28 and the re-write of the file command in terms of that library. The library
29 itself, libmagic can be used by 3rd party programs that wish to identify
30 file types without having to fork() and exec() file. The prime contributor
31 for 4.0 was M\xe5ns Rullg\xe5rd.
32
33 UNIX is a trademark of UNIX System Laboratories.
34
35 The prime contributor to Release 3.8 was Guy Harris, who put in megachanges
36 including byte-order independence.
37
38 The prime contributor to Release 3.0 was Christos Zoulas, who put
39 in hundreds of lines of source code changes, including his own
40 ANSIfication of the code (I liked my own ANSIfication better, but
41 his (__P()) is the "Berkeley standard" way of doing it, and I wanted UCB
42 to include the code...), his HP-like "indirection" (a feature of
43 the HP file command, I think), and his mods that finally got the
44 uncompress (-z) mode finished and working.
45
46 This release has compiled in numerous environments; see PORTING
47 for a list and problems.
48
49 This fine freeware file(1) follows the USG (System V) model of the file
50 command, rather than the Research (V7) version or the V7-derived 4.[23]
51 Berkeley one. That is, the file /etc/magic contains much of the ritual
52 information that is the source of this program's power. My version
53 knows a little more magic (including tar archives) than System V; the
54 /etc/magic parsing seems to be compatible with the (poorly documented)
55 System V /etc/magic format (with one exception; see the man page).
56
57 In addition, the /etc/magic file is built from a subdirectory
58 for easier(?) maintenance.  I will act as a clearinghouse for
59 magic numbers assigned to all sorts of data files that
60 are in reasonable circulation. Send your magic numbers,
61 in magic(5) format please, to the maintainer, Christos Zoulas.
62
63 COPYING - read this first.
64 README - read this second (you are currently reading this file).
65 INSTALL - read on how to install
66
67 src/apprentice.c - parses /etc/magic to learn magic
68 src/apptype.c - used for OS/2 specific application type magic
69 src/asprintf.c - replacement for OS's that don't have it.
70 src/ascmagic.c - third & last set of tests, based on hardwired assumptions.
71 src/cdf.c - parser for Microsoft Compound Document Files
72 src/cdf_time.c - time converter for CDF.
73 src/compress.c - handles decompressing files to look inside.
74 src/encoding.c - handles unicode encodings
75 src/file.c - the main program
76 src/file.h - header file
77 src/fsmagic.c - first set of tests the program runs, based on filesystem info
78 src/funcs.c - utilility functions
79 src/getopt_long.c - used for OS/2 specific application type magic
80 src/is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
81 src/names.h - header file for ascmagic.c
82 src/magic.c - the libmagic api
83 src/print.c - print results, errors, warnings.
84 src/readcdf.c - CDF wrapper.
85 src/readelf.[ch] - Stand-alone elf parsing code.
86 src/softmagic.c - 2nd set of tests, based on /etc/magic
87 src/strlcat.c - used for OS/2 specific application type magic
88 src/strlcpy.c - used for OS/2 specific application type magic
89 src/vasprintf.c - used for OS/2 specific application type magic
90 doc/file.1 - man page for the command
91 doc/magic.4 - man page for the magic file, courtesy Guy Harris.
92         Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
93 Magdir - directory of /etc/magic pieces
94
95 ------------------------------------------------------------------------------
96
97 If you submit a new magic entry please make sure you read the following
98 guidelines:
99
100 - Initial match is preferably at least 32 bits long, and is a _unique_ match
101 - If this is not feasible, use additional check
102 - Match of <= 16 bits are not accepted
103 - Delay printing string as much as possible, don't print output too early
104 - Avoid printf arbitrary byte as string, which can be a source of
105   crash and buffer overflow
106
107 - Provide complete information with entry:
108   * One line short summary
109   * Optional long description
110   * File extension, if applicable
111   * Full name and contact method (for discussion when entry has problem)
112   * Further reference, such as documentation of format
113
114 ------------------------------------------------------------------------------
115
116 Parts of this software were developed at SoftQuad Inc., developers
117 of SGML/HTML/XML publishing software, in Toronto, Canada.
118 SoftQuad was swallowed up by Corel in 2002 and does not exist any longer.