README 5.1 KB

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