• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

doc/H31-Mar-2021-2,6882,601

m4/H31-Mar-2021-9,0578,186

magic/H31-Mar-2021-36,98334,095

python/H07-May-2022-928736

src/H31-Mar-2021-22,14317,421

tests/H07-May-2022-1,112969

AUTHORSH A D22-Feb-202113 21

COPYINGH A D22-Feb-20211.6 KiB3026

ChangeLogH A D31-Mar-202155.9 KiB1,9561,166

INSTALLH A D22-Feb-202115.2 KiB366284

MAINTH A D22-Feb-20211.5 KiB4535

Makefile.amH A D22-Feb-2021289 115

Makefile.inH A D31-Mar-202127.7 KiB883780

NEWSH A D22-Feb-202115 21

READMEH A D22-Feb-20216.9 KiB158126

TODOH A D22-Feb-20212 KiB5045

acinclude.m4H A D22-Feb-20212 KiB5952

aclocal.m4H A D31-Mar-202144.3 KiB1,2201,111

compileH A D31-Mar-20217.2 KiB349259

config.guessH A D31-Mar-202143.9 KiB1,5071,308

config.h.inH A D31-Mar-202111.3 KiB427300

config.subH A D31-Mar-202130.8 KiB1,7961,639

configureH A D31-Mar-2021498.4 KiB17,47314,622

configure.acH A D31-Mar-20216.5 KiB222199

depcompH A D31-Mar-202123 KiB792502

install-shH A D31-Mar-20216.6 KiB302199

libmagic.pc.inH A D12-Feb-2020210 119

ltmain.shH A D31-Mar-2021316.8 KiB11,1637,994

missingH A D31-Mar-20216.7 KiB216143

README

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