1. ** README for file(1) Command **
  2. @(#) $File: README,v 1.41 2008/12/02 16:34:46 christos Exp $
  3. E-mail:
  4. Mailing List:
  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. INSTALL - read on how to install
  41. src/apprentice.c - parses /etc/magic to learn magic
  42. src/apptype.c - used for OS/2 specific application type magic
  43. src/asprintf.c - replacement for OS's that don't have it.
  44. src/ascmagic.c - third & last set of tests, based on hardwired assumptions.
  45. src/cdf.c - parser for Microsoft Compound Document Files
  46. src/cdf_time.c - time converter for CDF.
  47. src/compress.c - handles decompressing files to look inside.
  48. src/encoding.c - handles unicode encodings
  49. src/file.c - the main program
  50. src/file.h - header file
  51. src/fsmagic.c - first set of tests the program runs, based on filesystem info
  52. src/funcs.c - utilility functions
  53. src/getopt_long.c - used for OS/2 specific application type magic
  54. src/is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
  55. src/names.h - header file for ascmagic.c
  56. src/magic.c - the libmagic api
  57. src/print.c - print results, errors, warnings.
  58. src/readcdf.c - CDF wrapper.
  59. src/readelf.[ch] - Stand-alone elf parsing code.
  60. src/softmagic.c - 2nd set of tests, based on /etc/magic
  61. src/strlcat.c - used for OS/2 specific application type magic
  62. src/strlcpy.c - used for OS/2 specific application type magic
  63. src/vasprintf.c - used for OS/2 specific application type magic
  64. doc/file.1 - man page for the command
  65. doc/magic.4 - man page for the magic file, courtesy Guy Harris.
  66. Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
  67. Magdir - directory of /etc/magic pieces
  68. ------------------------------------------------------------------------------
  69. If you submit a new magic entry please make sure you read the following
  70. guidelines:
  71. - Initial match is preferably at least 32 bits long, and is a _unique_ match
  72. - If this is not feasible, use additional check
  73. - Match of <= 16 bits are not accepted
  74. - Delay printing string as much as possible, don't print output too early
  75. - Avoid printf arbitrary byte as string, which can be a source of
  76. crash and buffer overflow
  77. - Provide complete information with entry:
  78. * One line short summary
  79. * Optional long description
  80. * File extension, if applicable
  81. * Full name and contact method (for discussion when entry has problem)
  82. * Further reference, such as documentation of format
  83. ------------------------------------------------------------------------------
  84. You can download the latest version of file from:
  86. If your gzip sometimes fails to decompress things complaining about a short
  87. file, apply this patch [which is going to be in the next version of gzip]:
  88. *** - Tue Oct 29 02:06:35 1996
  89. --- util.c Sun Jul 21 21:51:38 1996
  90. *** 106,111 ****
  91. --- 108,114 ----
  92. if (insize == 0) {
  93. if (eof_ok) return EOF;
  94. + flush_window();
  95. read_error();
  96. }
  97. bytes_in += (ulg)insize;
  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
  101. and does not exist any longer.
  102. From: Kees Zeelenberg
  103. An MS-Windows (Win32) port of File-4.17 is available from
  105. File is an implementation of the Unix File(1) command.
  106. It knows the 'magic number' of several thousands of file types.