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