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