1. ** README for file(1) Command **
  2. @(#) $File: README,v 1.34 2006/05/03 18:48:33 christos Exp $
  3. This is Release 4.x of Ian Darwin's (copyright but distributable)
  4. file(1) command. This version is the standard "file" command for Linux,
  5. *BSD, and other systems. (See "patchlevel.h" for the exact release number).
  6. The major feature of 4.x is the refactoring of the code into a library,
  7. and the re-write of the file command in terms of that library. The library
  8. itself, libmagic can be used by 3rd party programs that wish to identify
  9. file types without having to fork() and exec() file. The prime contributor
  10. for 4.0 was M\xe5ns Rullg\xe5rd.
  11. UNIX is a trademark of UNIX System Laboratories.
  12. The prime contributor to Release 3.8 was Guy Harris, who put in megachanges
  13. including byte-order independence.
  14. The prime contributor to Release 3.0 was Christos Zoulas, who put
  15. in hundreds of lines of source code changes, including his own
  16. ANSIfication of the code (I liked my own ANSIfication better, but
  17. his (__P()) is the "Berkeley standard" way of doing it, and I wanted UCB
  18. to include the code...), his HP-like "indirection" (a feature of
  19. the HP file command, I think), and his mods that finally got the
  20. uncompress (-z) mode finished and working.
  21. This release has compiled in numerous environments; see PORTING
  22. for a list and problems.
  23. This fine freeware file(1) follows the USG (System V) model of the file
  24. command, rather than the Research (V7) version or the V7-derived 4.[23]
  25. Berkeley one. That is, the file /etc/magic contains much of the ritual
  26. information that is the source of this program's power. My version
  27. knows a little more magic (including tar archives) than System V; the
  28. /etc/magic parsing seems to be compatible with the (poorly documented)
  29. System V /etc/magic format (with one exception; see the man page).
  30. In addition, the /etc/magic file is built from a subdirectory
  31. for easier(?) maintenance. I will act as a clearinghouse for
  32. magic numbers assigned to all sorts of data files that
  33. are in reasonable circulation. Send your magic numbers,
  34. in magic(5) format please, to the maintainer, Christos Zoulas.
  35. LEGAL.NOTICE - read this first.
  36. README - read this second (you are currently reading this file).
  37. PORTING - read this only if the program won't compile.
  38. Makefile - read this next, adapt it as needed (particularly
  39. the location of the old existing file command and
  40. the man page layouts), type "make" to compile,
  41. "make try" to try it out against your old version.
  42. Expect some diffs, particularly since your original
  43. file(1) may not grok the embedded-space ("\ ") in
  44. the current magic file, or may even not use the
  45. magic file.
  46. apprentice.c - parses /etc/magic to learn magic
  47. ascmagic.c - third & last set of tests, based on hardwired assumptions.
  48. core - not included in distribution due to mailer limitations.
  49. debug.c - includes -c printout routine
  50. file.1 - man page for the command
  51. magic.4 - man page for the magic file, courtesy Guy Harris.
  52. Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
  53. file.c - main program
  54. file.h - header file
  55. fsmagic.c - first set of tests the program runs, based on filesystem info
  56. is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
  57. magdir - directory of /etc/magic pieces
  59. names.h - header file for ascmagic.c
  60. softmagic.c - 2nd set of tests, based on /etc/magic
  61. readelf.[ch] - Stand-alone elf parsing code.
  62. compress.c - on-the-fly decompression.
  63. print.c - print results, errors, warnings.
  64. If your gzip sometimes fails to decompress things complaining about a short
  65. file, apply this patch [which is going to be in the next version of gzip]:
  66. *** - Tue Oct 29 02:06:35 1996
  67. --- util.c Sun Jul 21 21:51:38 1996
  68. *** 106,111 ****
  69. --- 108,114 ----
  70. if (insize == 0) {
  71. if (eof_ok) return EOF;
  72. + flush_window();
  73. read_error();
  74. }
  75. bytes_in += (ulg)insize;
  76. E-mail:
  77. Phone: Do not even think of telephoning me about this program. Send cash first!
  78. Parts of this software were developed at SoftQuad Inc., developers
  79. of SGML/HTML/XML publishing software, in Toronto, Canada.
  80. SoftQuad was swallowed up by Corel in 2002
  81. and does not exist any longer.
  82. From: Kees Zeelenberg
  83. An MS-Windows (Win32) port of File-4.17 is available from
  85. File is an implementation of the Unix File(1) command.
  86. It knows the 'magic number' of several thousands of file types.