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