11.TH FILE 1 "Copyright but distributable"
2- .\# $Id: file.man,v 1.21 1993/01 /05 14:55:13 ian Exp $
2+ .\# $Id: file.man,v 1.22 1993/04 /05 10:38:26 ian Exp $
33.SH NAME
44.I file
55\- determine file type
@@ -48,28 +48,29 @@ or the program itself,
4848.B "preserve these keywords" .
4949People depend on knowing that all the readable files in a directory
5050have the word ``text'' printed.
51- Don't do as one computer vendor did \- change ``shell commands text''
51+ Don't do as Berkeley did \- change ``shell commands text''
5252to ``shell script''.
5353.PP
5454The filesystem tests are based on examining the return from a
55- .I stat (2)
55+ .IR stat (2)
5656system call.
5757The program checks to see if the file is empty,
5858or if it's some sort of special file.
5959Any known file types appropriate to the system you are running on
60- (sockets and symbolic links on 4.2BSD, named pipes (FIFOs) on System V)
60+ (sockets, symbolic links, or named pipes (FIFOs) on those systems that
61+ implement them)
6162are intuited if they are defined in
6263the system header file
63- .I sys/stat.h .
64+ .BR sys/stat.h .
6465.PP
6566The magic number tests are used to check for files with data in
6667particular fixed formats.
6768The canonical example of this is a binary executable (compiled program)
68- .I a.out
69+ .B a.out
6970file, whose format is defined in
70- .I a.out.h
71+ .B a.out.h
7172and possibly
72- .I exec.h
73+ .B exec.h
7374in the standard include directory.
7475These files have a `magic number' stored in a particular place
7576near the beginning of the file that tells the \s- 1 UNIX\s 0 operating system
@@ -88,10 +89,10 @@ attempts to guess its language.
8889The language tests look for particular strings (cf \fI names.h \fP )
8990that can appear anywhere in the first few blocks of a file.
9091For example, the keyword
91- .I .br
92+ .B .br
9293indicates that the file is most likely a troff input file,
9394just as the keyword
94- .I struct
95+ .B struct
9596indicates a C program.
9697These tests are less reliable than the previous
9798two groups, so they are performed last.
@@ -131,7 +132,8 @@ to test the standard input, use ``-'' as a filename argument.
131132.PP
132133The
133134.B \- L
134- option causes symlinks to be followed, as the like-named option in ls(1).
135+ option causes symlinks to be followed, as the like-named option in
136+ .IR ls (1).
135137.SH FILES
136138.I __MAGIC__
137139\- default list of magic numbers
@@ -160,9 +162,20 @@ For example,
160162in an existing magic file would have to be changed to
161163.br
162164>10 string language\e impress (imPRESS data)
165+ .br
166+ In addition, in this version, if a pattern string contains a backslash,
167+ it must be escaped. For example
168+ .br
169+ 0 string\e begindata Andrew Toolkit document
170+ .br
171+ in an existing magic file would have to be changed to
172+ .br
173+ 0 string\e\e begindata Andrew Toolkit document
174+ .br
163175.PP
164- The Sun Microsystems implementation of System V compatibility
165- includes a file(1) command that has some extentions.
176+ SunOS releases 3.2 and later from Sun Microsystems include a
177+ .IR file (1)
178+ command derived from the System V one, but with some extensions.
166179My version differs from Sun's only in minor ways.
167180It includes the extension of the `&' operator, used as,
168181for example,
@@ -210,6 +223,25 @@ postal address: P.O. Box 603, Station F, Toronto, Ontario, CANADA M4Y 2L8.
210223Altered by Rob McMahon, cudcv@warwick.ac.uk, 1989, to extend the `&' operator
211224from simple `x&y != 0' to `x&y op z'.
212225.PP
226+ Altered by Guy Harris, guy@auspex.com, 1993, to:
227+ .RS
228+ .PP
229+ put the ``old-style'' `&'
230+ operator back the way it was, because 1) Rob McMahon's change broke the
231+ previous style of usage, 2) the SunOS ``new-style'' `&' operator,
232+ which this version of
233+ .I file
234+ supports, also handles `x&y op z', and 3) Rob's change wasn't documented
235+ in any case;
236+ .PP
237+ put in multiple levels of `>';
238+ .PP
239+ put in ``beshort'', ``leshort'', etc. keywords to look at numbers in the
240+ file in a specific byte order, rather than in the native byte order of
241+ the process running
242+ .IR file .
243+ .RE
244+ .PP
213245Changes by Ian Darwin and various authors including
214246Christos Zoulas (christos@ee.cornell.edu), 1990-1992.
215247.SH LEGAL NOTICE
@@ -260,8 +292,9 @@ program, and are not covered by the above restrictions.
260292.SH BUGS
261293There must be a better way to automate the construction of the Magic
262294file from all the glop in Magdir. What is it?
263- Better yet, the magic file should be compiled into binary (say, ndbm(3) or,
264- better yet, fixed-length ASCII strings
295+ Better yet, the magic file should be compiled into binary (say,
296+ .IR ndbm (3)
297+ or, better yet, fixed-length ASCII strings
265298for use in heterogenous network environments) for faster startup.
266299Then the program would run as fast as the Version 7 program of the same name,
267300with the flexibility of the System V version.
@@ -307,15 +340,12 @@ they are not as good as other guesses (e.g. ``Newsgroups:'' versus
307340"Return-Path:"). Still, if the others don't pan out, it should be
308341possible to use the first guess.
309342.PP
310- Perhaps the program should automatically try all tests with
311- byte-swapping done, to avoid having to figure out the byte-swapped values
312- when constructing the magic file.
313- Of course this will run more slowly, so it should probably be
314- an option (-a?).
315- .PP
316343This program is slower than some vendors' file commands.
317344.PP
318345This manual page, and particularly this section, is too long.
319346.SH AVAILABILITY
320347You can obtain the original author's latest version by anonymous FTP
321- on ftp.cs.toronto.edu in the directory /pub/darwin/file.
348+ on
349+ .B ftp.cs.toronto.edu
350+ in the directory
351+ .BR /pub/darwin/file .
0 commit comments