1. ** README for file(1) Command **
  2. @(#) $File: README,v 1.47 2013/06/04 23:15:02 ian Exp $
  3. Mailing List:
  4. Mailing List archives:
  5. Bug tracker:
  6. E-mail:
  7. Phone: Do not even think of telephoning me about this program. Send cash first!
  8. This is Release 5.x of Ian Darwin's (copyright but distributable)
  9. file(1) command, an implementation of the Unix File(1) command.
  10. It knows the 'magic number' of several thousands of file types.
  11. This version is the standard "file" command for Linux,
  12. *BSD, and other systems. (See "patchlevel.h" for the exact release number).
  13. You can download the latest version of the original sources for file from:
  15. A public read-only git repository of the same sources is available at:
  17. The major changes for 5.x are CDF file parsing, indirect magic, and
  18. overhaul in mime and ascii encoding handling.
  19. The major feature of 4.x is the refactoring of the code into a library,
  20. and the re-write of the file command in terms of that library. The library
  21. itself, libmagic can be used by 3rd party programs that wish to identify
  22. file types without having to fork() and exec() file. The prime contributor
  23. for 4.0 was Mans Rullgard.
  24. UNIX is a trademark of UNIX System Laboratories.
  25. The prime contributor to Release 3.8 was Guy Harris, who put in megachanges
  26. including byte-order independence.
  27. The prime contributor to Release 3.0 was Christos Zoulas, who put
  28. in hundreds of lines of source code changes, including his own
  29. ANSIfication of the code (I liked my own ANSIfication better, but
  30. his (__P()) is the "Berkeley standard" way of doing it, and I wanted UCB
  31. to include the code...), his HP-like "indirection" (a feature of
  32. the HP file command, I think), and his mods that finally got the
  33. uncompress (-z) mode finished and working.
  34. This release has compiled in numerous environments; see PORTING
  35. for a list and problems.
  36. This fine freeware file(1) follows the USG (System V) model of the file
  37. command, rather than the Research (V7) version or the V7-derived 4.[23]
  38. Berkeley one. That is, the file /etc/magic contains much of the ritual
  39. information that is the source of this program's power. My version
  40. knows a little more magic (including tar archives) than System V; the
  41. /etc/magic parsing seems to be compatible with the (poorly documented)
  42. System V /etc/magic format (with one exception; see the man page).
  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. COPYING - read this first.
  49. README - read this second (you are currently reading this file).
  50. INSTALL - read on how to install
  51. src/apprentice.c - parses /etc/magic to learn magic
  52. src/apptype.c - used for OS/2 specific application type magic
  53. src/asprintf.c - replacement for OS's that don't have it.
  54. src/ascmagic.c - third & last set of tests, based on hardwired assumptions.
  55. src/asctime_r.c - for systems that don't have it.
  56. src/asprintf.c - for systems that don't have it.
  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/ctime_r.c - for systems that don't have it.
  61. src/encoding.c - handles unicode encodings
  62. src/file.c - the main program
  63. src/file.h - header file
  64. src/fsmagic.c - first set of tests the program runs, based on filesystem info
  65. src/funcs.c - utilility functions
  66. src/getopt_long.c - for systems that don't have it.
  67. src/getline.c - for systems that don't have it.
  68. src/is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
  69. src/names.h - header file for ascmagic.c
  70. src/magic.c - the libmagic api
  71. src/print.c - print results, errors, warnings.
  72. src/readcdf.c - CDF wrapper.
  73. src/readelf.[ch] - Stand-alone elf parsing code.
  74. src/softmagic.c - 2nd set of tests, based on /etc/magic
  75. src/strlcat.c - for systems that don't have it.
  76. src/strlcpy.c - for systems that don't have it.
  77. src/vasprintf.c - for systems that don't have it.
  78. doc/ - man page for the command
  79. doc/ - man page for the magic file, courtesy Guy Harris.
  80. Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
  81. Magdir - directory of /etc/magic pieces
  82. ------------------------------------------------------------------------------
  83. If you submit a new magic entry please make sure you read the following
  84. guidelines:
  85. - Initial match is preferably at least 32 bits long, and is a _unique_ match
  86. - If this is not feasible, use additional check
  87. - Match of <= 16 bits are not accepted
  88. - Delay printing string as much as possible, don't print output too early
  89. - Avoid printf arbitrary byte as string, which can be a source of
  90. crash and buffer overflow
  91. - Provide complete information with entry:
  92. * One line short summary
  93. * Optional long description
  94. * File extension, if applicable
  95. * Full name and contact method (for discussion when entry has problem)
  96. * Further reference, such as documentation of format
  97. ------------------------------------------------------------------------------
  98. Parts of this software were developed at SoftQuad Inc., developers
  99. of SGML/HTML/XML publishing software, in Toronto, Canada.
  100. SoftQuad was swallowed up by Corel in 2002 and does not exist any longer.