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