README 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. ** README for file(1) Command **
  2. @(#) $File: README,v 1.45 2013/01/11 16:51:01 christos 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/asctime_r.c - for systems that don't have it.
  55. src/asprintf.c - for systems that don't have it.
  56. src/cdf.c - parser for Microsoft Compound Document Files
  57. src/cdf_time.c - time converter for CDF.
  58. src/compress.c - handles decompressing files to look inside.
  59. src/ctime_r.c - for systems that don't have it.
  60. src/encoding.c - handles unicode encodings
  61. src/file.c - the main program
  62. src/file.h - header file
  63. src/fsmagic.c - first set of tests the program runs, based on filesystem info
  64. src/funcs.c - utilility functions
  65. src/getopt_long.c - for systems that don't have it.
  66. src/getline.c - for systems that don't have it.
  67. src/is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
  68. src/names.h - header file for ascmagic.c
  69. src/magic.c - the libmagic api
  70. src/print.c - print results, errors, warnings.
  71. src/readcdf.c - CDF wrapper.
  72. src/readelf.[ch] - Stand-alone elf parsing code.
  73. src/softmagic.c - 2nd set of tests, based on /etc/magic
  74. src/strlcat.c - for systems that don't have it.
  75. src/strlcpy.c - for systems that don't have it.
  76. src/vasprintf.c - for systems that don't have it.
  77. doc/file.man - man page for the command
  78. doc/magic.man - man page for the magic file, courtesy Guy Harris.
  79. Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
  80. Magdir - directory of /etc/magic pieces
  81. ------------------------------------------------------------------------------
  82. If you submit a new magic entry please make sure you read the following
  83. guidelines:
  84. - Initial match is preferably at least 32 bits long, and is a _unique_ match
  85. - If this is not feasible, use additional check
  86. - Match of <= 16 bits are not accepted
  87. - Delay printing string as much as possible, don't print output too early
  88. - Avoid printf arbitrary byte as string, which can be a source of
  89. crash and buffer overflow
  90. - Provide complete information with entry:
  91. * One line short summary
  92. * Optional long description
  93. * File extension, if applicable
  94. * Full name and contact method (for discussion when entry has problem)
  95. * Further reference, such as documentation of format
  96. ------------------------------------------------------------------------------
  97. Parts of this software were developed at SoftQuad Inc., developers
  98. of SGML/HTML/XML publishing software, in Toronto, Canada.
  99. SoftQuad was swallowed up by Corel in 2002 and does not exist any longer.