README 5.5 KB

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