README 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. ** README for file(1) Command **
  2. @(#) $File: README,v 1.40 2008/04/23 03:45:20 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 4.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 feature of 4.x is the refactoring of the code into a library,
  10. and the re-write of the file command in terms of that library. The library
  11. itself, libmagic can be used by 3rd party programs that wish to identify
  12. file types without having to fork() and exec() file. The prime contributor
  13. for 4.0 was M\xe5ns Rullg\xe5rd.
  14. UNIX is a trademark of UNIX System Laboratories.
  15. The prime contributor to Release 3.8 was Guy Harris, who put in megachanges
  16. including byte-order independence.
  17. The prime contributor to Release 3.0 was Christos Zoulas, who put
  18. in hundreds of lines of source code changes, including his own
  19. ANSIfication of the code (I liked my own ANSIfication better, but
  20. his (__P()) is the "Berkeley standard" way of doing it, and I wanted UCB
  21. to include the code...), his HP-like "indirection" (a feature of
  22. the HP file command, I think), and his mods that finally got the
  23. uncompress (-z) mode finished and working.
  24. This release has compiled in numerous environments; see PORTING
  25. for a list and problems.
  26. This fine freeware file(1) follows the USG (System V) model of the file
  27. command, rather than the Research (V7) version or the V7-derived 4.[23]
  28. Berkeley one. That is, the file /etc/magic contains much of the ritual
  29. information that is the source of this program's power. My version
  30. knows a little more magic (including tar archives) than System V; the
  31. /etc/magic parsing seems to be compatible with the (poorly documented)
  32. System V /etc/magic format (with one exception; see the man page).
  33. In addition, the /etc/magic file is built from a subdirectory
  34. for easier(?) maintenance. I will act as a clearinghouse for
  35. magic numbers assigned to all sorts of data files that
  36. are in reasonable circulation. Send your magic numbers,
  37. in magic(5) format please, to the maintainer, Christos Zoulas.
  38. COPYING - read this first.
  39. README - read this second (you are currently reading this file).
  40. PORTING - read this only if the program won't compile.
  41. Makefile - read this next, adapt it as needed (particularly
  42. the location of the old existing file command and
  43. the man page layouts), type "make" to compile,
  44. "make try" to try it out against your old version.
  45. Expect some diffs, particularly since your original
  46. file(1) may not grok the embedded-space ("\ ") in
  47. the current magic file, or may even not use the
  48. magic file.
  49. apprentice.c - parses /etc/magic to learn magic
  50. ascmagic.c - third & last set of tests, based on hardwired assumptions.
  51. core - not included in distribution due to mailer limitations.
  52. debug.c - includes -c printout routine
  53. file.1 - man page for the command
  54. magic.4 - man page for the magic file, courtesy Guy Harris.
  55. Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
  56. file.c - main program
  57. file.h - header file
  58. fsmagic.c - first set of tests the program runs, based on filesystem info
  59. is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
  60. magdir - directory of /etc/magic pieces
  61. magdir/Makefile - ADJUST THIS FOR YOUR CONFIGURATION
  62. names.h - header file for ascmagic.c
  63. softmagic.c - 2nd set of tests, based on /etc/magic
  64. readelf.[ch] - Stand-alone elf parsing code.
  65. compress.c - on-the-fly decompression.
  66. print.c - print results, errors, warnings.
  67. ------------------------------------------------------------------------------
  68. If you submit a new magic entry please make sure you read the following
  69. guidelines:
  70. - Initial match is preferably at least 32 bits long, and is a _unique_ match
  71. - If this is not feasible, use additional check
  72. - Match of <= 16 bits are not accepted
  73. - Delay printing string as much as possible, don't print output too early
  74. - Avoid printf arbitrary byte as string, which can be a source of
  75. crash and buffer overflow
  76. - Provide complete information with entry:
  77. * One line short summary
  78. * Optional long description
  79. * File extension, if applicable
  80. * Full name and contact method (for discussion when entry has problem)
  81. * Further reference, such as documentation of format
  82. ------------------------------------------------------------------------------
  83. You can download the latest version of file from:
  84. ftp://ftp.astron.com/pub/file/
  85. If your gzip sometimes fails to decompress things complaining about a short
  86. file, apply this patch [which is going to be in the next version of gzip]:
  87. *** - Tue Oct 29 02:06:35 1996
  88. --- util.c Sun Jul 21 21:51:38 1996
  89. *** 106,111 ****
  90. --- 108,114 ----
  91. if (insize == 0) {
  92. if (eof_ok) return EOF;
  93. + flush_window();
  94. read_error();
  95. }
  96. bytes_in += (ulg)insize;
  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
  100. and does not exist any longer.
  101. From: Kees Zeelenberg
  102. An MS-Windows (Win32) port of File-4.17 is available from
  103. http://gnuwin32.sourceforge.net/
  104. File is an implementation of the Unix File(1) command.
  105. It knows the 'magic number' of several thousands of file types.