[BACK]Return to file.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / file

Diff for /src/usr.bin/file/file.1 between version 1.3 and 1.4

version 1.3, 1996/06/26 05:32:56 version 1.4, 1997/02/09 23:58:20
Line 1 
Line 1 
 .\" $OpenBSD$  .\" $OpenBSD$
 .TH FILE 1 "Copyright but distributable"  .TH FILE 1 "Copyrighted but distributable"
 .SH NAME  .SH NAME
 file  file
 \- determine file type  \- determine file type
Line 16 
Line 16 
 magicfiles ]  magicfiles ]
 file ...  file ...
 .SH DESCRIPTION  .SH DESCRIPTION
 .I File  This manual page documents version 3.22 of the
   .B file
   command.
   .B File
 tests each argument in an attempt to classify it.  tests each argument in an attempt to classify it.
 There are three sets of tests, performed in this order:  There are three sets of tests, performed in this order:
 filesystem tests, magic number tests, and language tests.  filesystem tests, magic number tests, and language tests.
Line 26 
Line 29 
 .PP  .PP
 The type printed will usually contain one of the words  The type printed will usually contain one of the words
 .B text  .B text
 (the file contains only ASCII characters and is  (the file contains only
 probably safe to read on an ASCII terminal),  .SM ASCII
   characters and is probably safe to read on an
   .SM ASCII
   terminal),
 .B executable  .B executable
 (the file contains the result of compiling a program  (the file contains the result of compiling a program
 in a form understandable to some \s-1UNIX\s0 kernel or another),  in a form understandable to some \s-1UNIX\s0 kernel or another),
Line 46 
Line 52 
 to ``shell script''.  to ``shell script''.
 .PP  .PP
 The filesystem tests are based on examining the return from a  The filesystem tests are based on examining the return from a
 .IR stat (2)  .BR stat (2)
 system call.  system call.
 The program checks to see if the file is empty,  The program checks to see if the file is empty,
 or if it's some sort of special file.  or if it's some sort of special file.
Line 55 
Line 61 
 implement them)  implement them)
 are intuited if they are defined in  are intuited if they are defined in
 the system header file  the system header file
 .BR sys/stat.h  .  .IR sys/stat.h  .
 .PP  .PP
 The magic number tests are used to check for files with data in  The magic number tests are used to check for files with data in
 particular fixed formats.  particular fixed formats.
 The canonical example of this is a binary executable (compiled program)  The canonical example of this is a binary executable (compiled program)
 .B a.out  .I a.out
 file, whose format is defined in  file, whose format is defined in
 .B a.out.h  .I a.out.h
 and possibly  and possibly
 .B exec.h  .I exec.h
 in the standard include directory.  in the standard include directory.
 These files have a `magic number' stored in a particular place  These files have a `magic number' stored in a particular place
 near the beginning of the file that tells the \s-1UNIX\s0 operating system  near the beginning of the file that tells the \s-1UNIX\s0 operating system
Line 78 
Line 84 
 If an argument appears to be an  If an argument appears to be an
 .SM ASCII  .SM ASCII
 file,  file,
 .I file  .B file
 attempts to guess its language.  attempts to guess its language.
 The language tests look for particular strings (cf \fInames.h\fP)  The language tests look for particular strings (cf
   .IR names.h )
 that can appear anywhere in the first few blocks of a file.  that can appear anywhere in the first few blocks of a file.
 For example, the keyword  For example, the keyword
 .B .br  .B .br
 indicates that the file is most likely a troff input file,  indicates that the file is most likely a
 just as the keyword  .BR troff (1)
   input file, just as the keyword
 .B struct  .B struct
 indicates a C program.  indicates a C program.
 These tests are less reliable than the previous  These tests are less reliable than the previous
 two groups, so they are performed last.  two groups, so they are performed last.
 The language test routines also test for some miscellany  The language test routines also test for some miscellany
 (such as  (such as
 .I tar  .BR tar (1)
 archives) and determine whether an unknown file should be  archives) and determine whether an unknown file should be
 labelled as `ascii text' or `data'.  labelled as `ascii text' or `data'.
 .SH OPTIONS  .SH OPTIONS
Line 125 
Line 133 
 .TP 8  .TP 8
 .B \-L  .B \-L
 option causes symlinks to be followed, as the like-named option in  option causes symlinks to be followed, as the like-named option in
 .IR ls (1).  .BR ls (1).
 (on systems that support symbolic links).  (on systems that support symbolic links).
 .SH FILES  .SH FILES
 .I /etc/magic  .I /etc/magic
Line 135 
Line 143 
 .B MAGIC  .B MAGIC
 can be used to set the default magic number files.  can be used to set the default magic number files.
 .SH SEE ALSO  .SH SEE ALSO
 .IR magic (5)  .BR magic (5)
 \- description of magic file format.  \- description of magic file format.
 .br  .br
 .IR Strings (1), " od" (1)  .BR strings (1), " od" (1)
 \- tools for examining non-textfiles.  \- tools for examining non-textfiles.
 .SH STANDARDS CONFORMANCE  .SH STANDARDS CONFORMANCE
 This program is believed to exceed the System V Interface Definition  This program is believed to exceed the System V Interface Definition
Line 171 
Line 179 
 .br  .br
 .PP  .PP
 SunOS releases 3.2 and later from Sun Microsystems include a  SunOS releases 3.2 and later from Sun Microsystems include a
 .IR file (1)  .BR file (1)
 command derived from the System V one, but with some extensions.  command derived from the System V one, but with some extensions.
 My version differs from Sun's only in minor ways.  My version differs from Sun's only in minor ways.
 It includes the extension of the `&' operator, used as,  It includes the extension of the `&' operator, used as,
Line 190 
Line 198 
 Depending on what system you are using, the order that  Depending on what system you are using, the order that
 they are put together may be incorrect.  they are put together may be incorrect.
 If your old  If your old
 .I file  .B file
 command uses a magic file,  command uses a magic file,
 keep the old magic file around for comparison purposes  keep the old magic file around for comparison purposes
 (rename it to  (rename it to
 .IR /etc/magic.orig ).  .IR /etc/magic.orig ).
 .SH HISTORY  .SH HISTORY
 There has been a  There has been a
 .I file  .B file
 command in every UNIX since at least Research Version 6  command in every \s-1UNIX\s0 since at least Research Version 6
 (man page dated January, 1975).  (man page dated January, 1975).
 The System V version introduced one significant major change:  The System V version introduced one significant major change:
 the external list of magic number types.  the external list of magic number types.
Line 227 
Line 235 
 operator back the way it was, because 1) Rob McMahon's change broke the  operator back the way it was, because 1) Rob McMahon's change broke the
 previous style of usage, 2) the SunOS ``new-style'' `&' operator,  previous style of usage, 2) the SunOS ``new-style'' `&' operator,
 which this version of  which this version of
 .I file  .B file
 supports, also handles `x&y op z', and 3) Rob's change wasn't documented  supports, also handles `x&y op z', and 3) Rob's change wasn't documented
 in any case;  in any case;
 .PP  .PP
Line 236 
Line 244 
 put in ``beshort'', ``leshort'', etc. keywords to look at numbers in the  put in ``beshort'', ``leshort'', etc. keywords to look at numbers in the
 file in a specific byte order, rather than in the native byte order of  file in a specific byte order, rather than in the native byte order of
 the process running  the process running
 .IR file .  .BR file .
 .RE  .RE
 .PP  .PP
 Changes by Ian Darwin and various authors including  Changes by Ian Darwin and various authors including
 Christos Zoulas (christos@ee.cornell.edu), 1990-1992.  Christos Zoulas (christos@deshaw.com), 1990-1997.
 .SH LEGAL NOTICE  .SH LEGAL NOTICE
 Copyright (c) Ian F. Darwin, Toronto, Canada,  Copyright (c) Ian F. Darwin, Toronto, Canada,
 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993.  1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993.
Line 284 
Line 292 
 and  and
 .I is_tar.c  .I is_tar.c
 were written by John Gilmore from his public-domain  were written by John Gilmore from his public-domain
 .I tar  .B tar
 program, and are not covered by the above restrictions.  program, and are not covered by the above restrictions.
 .SH BUGS  .SH BUGS
 There must be a better way to automate the construction of the Magic  There must be a better way to automate the construction of the Magic
 file from all the glop in Magdir. What is it?  file from all the glop in Magdir. What is it?
 Better yet, the magic file should be compiled into binary (say,  Better yet, the magic file should be compiled into binary (say,
 .IR ndbm (3)  .BR ndbm (3)
 or, better yet, fixed-length ASCII strings  or, better yet, fixed-length
 for use in heterogenous network environments) for faster startup.  .SM ASCII
   strings for use in heterogenous network environments) for faster startup.
 Then the program would run as fast as the Version 7 program of the same name,  Then the program would run as fast as the Version 7 program of the same name,
 with the flexibility of the System V version.  with the flexibility of the System V version.
 .PP  .PP
 .I File  .B File
 uses several algorithms that favor speed over accuracy,  uses several algorithms that favor speed over accuracy,
 thus it can be misled about the contents of ASCII files.  thus it can be misled about the contents of
   .SM ASCII
   files.
 .PP  .PP
 The support for ASCII files (primarily for programming languages)  The support for
   .SM ASCII
   files (primarily for programming languages)
 is simplistic, inefficient and requires recompilation to update.  is simplistic, inefficient and requires recompilation to update.
 .PP  .PP
 There should be an ``else'' clause to follow a series of continuation lines.  There should be an ``else'' clause to follow a series of continuation lines.
 .PP  .PP
 The magic file and keywords should have regular expression support.  The magic file and keywords should have regular expression support.
 Their use of ASCII TAB as a field delimiter is ugly and makes  Their use of
   .SM "ASCII TAB"
   as a field delimiter is ugly and makes
 it hard to edit the files, but is entrenched.  it hard to edit the files, but is entrenched.
 .PP  .PP
 It might be advisable to allow upper-case letters in keywords  It might be advisable to allow upper-case letters in keywords
 for e.g., troff commands vs man page macros.  for e.g.,
   .BR troff (1)
   commands vs man page macros.
 Regular expression support would make this easy.  Regular expression support would make this easy.
 .PP  .PP
 The program doesn't grok \s-2FORTRAN\s0.  The program doesn't grok \s-2FORTRAN\s0.
Line 343 
Line 360 
 .SH AVAILABILITY  .SH AVAILABILITY
 You can obtain the original author's latest version by anonymous FTP  You can obtain the original author's latest version by anonymous FTP
 on  on
 .B tesla.ee.cornell.edu  .B ftp.deshaw.com
 in the directory  in the directory
 .BR /pub/file-X.YY.tar.gz  .I /pub/file/file-X.YY.tar.gz

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4