README 6.7 KB

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