resolve conflicts
This commit is contained in:
parent
8bb07b3f43
commit
04d459813f
118
dist/file/doc/Makefile.in
vendored
118
dist/file/doc/Makefile.in
vendored
@ -1,8 +1,8 @@
|
||||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.10 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@ -13,15 +13,11 @@
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
@ -39,10 +35,10 @@ subdir = doc
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SOURCES =
|
||||
@ -57,8 +53,6 @@ NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
@ -85,24 +79,20 @@ EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
FSECT5_FALSE = @FSECT5_FALSE@
|
||||
FSECT5_TRUE = @FSECT5_TRUE@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
IS_CROSS_COMPILE_FALSE = @IS_CROSS_COMPILE_FALSE@
|
||||
IS_CROSS_COMPILE_TRUE = @IS_CROSS_COMPILE_TRUE@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
@ -116,16 +106,14 @@ SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
WARNINGS = @WARNINGS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
@ -137,7 +125,11 @@ build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
fsect = @fsect@
|
||||
host = @host@
|
||||
@ -145,21 +137,28 @@ host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
MAGIC = $(pkgdatadir)/magic
|
||||
@FSECT5_FALSE@man_MAGIC = magic.4
|
||||
@FSECT5_TRUE@man_MAGIC = magic.5
|
||||
@ -169,7 +168,7 @@ CLEANFILES = $(man_MANS)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
@ -194,9 +193,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
mostlyclean-libtool:
|
||||
@ -204,13 +203,9 @@ mostlyclean-libtool:
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
install-man1: $(man1_MANS) $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
|
||||
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
|
||||
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
@ -255,7 +250,7 @@ uninstall-man1:
|
||||
done
|
||||
install-man3: $(man3_MANS) $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man3dir)" || $(mkdir_p) "$(DESTDIR)$(man3dir)"
|
||||
test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)"
|
||||
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
@ -300,7 +295,7 @@ uninstall-man3:
|
||||
done
|
||||
install-man4: $(man4_MANS) $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man4dir)" || $(mkdir_p) "$(DESTDIR)$(man4dir)"
|
||||
test -z "$(man4dir)" || $(MKDIR_P) "$(DESTDIR)$(man4dir)"
|
||||
@list='$(man4_MANS) $(dist_man4_MANS) $(nodist_man4_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
@ -345,7 +340,7 @@ uninstall-man4:
|
||||
done
|
||||
install-man5: $(man5_MANS) $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man5dir)" || $(mkdir_p) "$(DESTDIR)$(man5dir)"
|
||||
test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
|
||||
@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
@ -396,22 +391,21 @@ CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
@ -427,7 +421,7 @@ check: check-am
|
||||
all-am: Makefile $(MANS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man4dir)" "$(DESTDIR)$(man5dir)"; do \
|
||||
test -z "$$dir" || $(mkdir_p) "$$dir"; \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
@ -460,7 +454,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-libtool
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
@ -474,12 +468,20 @@ info-am:
|
||||
|
||||
install-data-am: install-man
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man: install-man1 install-man3 install-man4 install-man5
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
@ -498,22 +500,26 @@ ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am uninstall-man
|
||||
uninstall-am: uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man1 uninstall-man3 uninstall-man4 \
|
||||
uninstall-man5
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
distclean distclean-generic distclean-libtool distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-exec install-exec-am \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-man1 \
|
||||
install-man3 install-man4 install-man5 install-strip \
|
||||
install-man3 install-man4 install-man5 install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
|
||||
uninstall-info-am uninstall-man uninstall-man1 uninstall-man3 \
|
||||
uninstall-man4 uninstall-man5
|
||||
uninstall-man uninstall-man1 uninstall-man3 uninstall-man4 \
|
||||
uninstall-man5
|
||||
|
||||
|
||||
file.1: Makefile file.man
|
||||
|
202
dist/file/doc/file.1
vendored
202
dist/file/doc/file.1
vendored
@ -1,7 +1,7 @@
|
||||
.\" $NetBSD: file.1,v 1.15 2007/06/07 11:32:45 pooka Exp $
|
||||
.\" $NetBSD: file.1,v 1.16 2008/08/30 11:39:01 christos Exp $
|
||||
.\"
|
||||
.\" $File: file.man,v 1.65 2007/01/25 21:05:46 christos Exp $
|
||||
.Dd January 8, 2007
|
||||
.\" $File: file.man,v 1.73 2008/02/19 17:58:00 rrt Exp $
|
||||
.Dd February 19, 2008
|
||||
.Dt FILE 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -10,6 +10,8 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl bchikLnNprsvz
|
||||
.Op Fl -mime-type
|
||||
.Op Fl -mime-encoding
|
||||
.Op Fl f Ar namefile
|
||||
.Op Fl F Ar separator
|
||||
.Op Fl m Ar magicfiles
|
||||
@ -17,15 +19,17 @@
|
||||
.Nm
|
||||
.Fl C
|
||||
.Op Fl m Ar magicfile
|
||||
.Nm
|
||||
.Op Fl -help
|
||||
.Sh DESCRIPTION
|
||||
This manual page documents version 4.21 of the
|
||||
This manual page documents version 4.26 of the
|
||||
.Nm
|
||||
command.
|
||||
.Pp
|
||||
.Nm
|
||||
tests each argument in an attempt to classify it.
|
||||
There are three sets of tests, performed in this order:
|
||||
filesystem tests, magic number tests, and language tests.
|
||||
filesystem tests, magic tests, and language tests.
|
||||
The
|
||||
.Em first
|
||||
test that succeeds causes the file type to be printed.
|
||||
@ -49,11 +53,9 @@ meaning anything else (data is usually
|
||||
or non-printable).
|
||||
Exceptions are well-known file formats (core files, tar archives)
|
||||
that are known to contain binary data.
|
||||
When modifying the file
|
||||
.Pa /usr/share/misc/magic
|
||||
or the program itself, make sure to
|
||||
When modifying magic files or the program itself, make sure to
|
||||
.Em "preserve these keywords" .
|
||||
People depend on knowing that all the readable files in a directory
|
||||
Users depend on knowing that all the readable files in a directory
|
||||
have the word
|
||||
.Dq text
|
||||
printed.
|
||||
@ -61,12 +63,6 @@ Don't do as Berkeley did and change
|
||||
.Dq shell commands text
|
||||
to
|
||||
.Dq shell script .
|
||||
Note that the file
|
||||
.Pa /usr/share/misc/magic
|
||||
is built mechanically from a large number of small files in
|
||||
the subdirectory
|
||||
.Pa Magdir
|
||||
in the source distribution of this program.
|
||||
.Pp
|
||||
The filesystem tests are based on examining the return from a
|
||||
.Xr stat 2
|
||||
@ -80,7 +76,7 @@ are intuited if they are defined in
|
||||
the system header file
|
||||
.In sys/stat.h .
|
||||
.Pp
|
||||
The magic number tests are used to check for files with data in
|
||||
The magic tests are used to check for files with data in
|
||||
particular fixed formats.
|
||||
The canonical example of this is a binary executable (compiled program)
|
||||
.Dv a.out
|
||||
@ -97,22 +93,20 @@ near the beginning of the file that tells the
|
||||
.Dv UNIX operating system
|
||||
that the file is a binary executable, and which of several types thereof.
|
||||
The concept of a
|
||||
.Sq "magic number"
|
||||
.Sq "magic"
|
||||
has been applied by extension to data files.
|
||||
Any file with some invariant identifier at a small fixed
|
||||
offset into the file can usually be described in this way.
|
||||
The information identifying these files is read from the compiled
|
||||
magic file
|
||||
.Pa /usr/share/misc/magic.mgc ,
|
||||
or
|
||||
.Pa /usr/share/misc/magic
|
||||
if the compile file does not exist. In addition
|
||||
.Nm
|
||||
will look in
|
||||
.Pa $HOME/.magic.mgc ,
|
||||
.Pa /usr/local/share/file/magic.mgc ,
|
||||
or the files in the directory
|
||||
.Pa /usr/local/share/file/magic
|
||||
if the compiled file does not exist. In addition, if
|
||||
.Pa $HOME/.magic.mgc
|
||||
or
|
||||
.Pa $HOME/.magic
|
||||
for magic entries.
|
||||
exists, it will be used in preference to the system magic files.
|
||||
.Pp
|
||||
If a file does not match any of the entries in the magic file,
|
||||
it is examined to see if it seems to be a text file.
|
||||
@ -145,9 +139,9 @@ Once
|
||||
has determined the character set used in a text-type file,
|
||||
it will
|
||||
attempt to determine in what language the file is written.
|
||||
The language tests look for particular strings (cf
|
||||
The language tests look for particular strings (cf.
|
||||
.In 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
|
||||
.Em .br
|
||||
indicates that the file is most likely a
|
||||
@ -163,7 +157,8 @@ The language test routines also test for some miscellany
|
||||
archives).
|
||||
.Pp
|
||||
Any file that cannot be identified as having been written
|
||||
in any of the character sets listed above is simply said to be ``data''.
|
||||
in any of the character sets listed above is simply said to be
|
||||
.Dq data .
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width indent
|
||||
.It Fl b , -brief
|
||||
@ -176,7 +171,7 @@ flag to debug a new magic file before installing it.
|
||||
.It Fl C , -compile
|
||||
Write a
|
||||
.Pa magic.mgc
|
||||
output file that contains a pre-parsed version of the magic file.
|
||||
output file that contains a pre-parsed version of the magic file or directory.
|
||||
.It Fl e , -exclude Ar testname
|
||||
Exclude the test named in
|
||||
.Ar testname
|
||||
@ -228,9 +223,8 @@ is not defined.
|
||||
.It Fl i , -mime
|
||||
Causes the file command to output mime type strings rather than the more
|
||||
traditional human readable ones. Thus it may say
|
||||
.Dq text/plain; charset=us-ascii
|
||||
rather
|
||||
than
|
||||
.Dq text/plain charset=us-ascii
|
||||
rather than
|
||||
.Dq ASCII text .
|
||||
In order for this option to work, file changes the way
|
||||
it handles files recognized by the command itself (such as many of the
|
||||
@ -240,8 +234,18 @@ file.
|
||||
(See
|
||||
.Dq FILES
|
||||
section, below).
|
||||
.It Fl -mime-type , -mime-encoding
|
||||
Like
|
||||
.Fl i ,
|
||||
but print only the specified element(s).
|
||||
.It Fl k , -keep-going
|
||||
Don't stop at the first match, keep going.
|
||||
Don't stop at the first match, keep going. Subsequent matches will be
|
||||
have the string
|
||||
.Dq "\[rs]012\- "
|
||||
prepended.
|
||||
(If you want a newline, see the
|
||||
.Dq "\-r"
|
||||
option.)
|
||||
.It Fl L , -dereference
|
||||
option causes symlinks to be followed, as the like-named option in
|
||||
.Xr ls 1
|
||||
@ -250,15 +254,9 @@ This is the default if the environment variable
|
||||
.Dv POSIXLY_CORRECT
|
||||
is defined.
|
||||
.It Fl m , -magic-file Ar list
|
||||
Specify an alternate list of files containing magic numbers.
|
||||
This can be a single file, or a colon-separated list of files.
|
||||
If a compiled magic file is found alongside, it will be used instead.
|
||||
With the
|
||||
.Fl i or
|
||||
.Fl "mime"
|
||||
option, the program adds
|
||||
.Dq .mime
|
||||
to each file name.
|
||||
Specify an alternate list of files and directories containing magic.
|
||||
This can be a single item, or a colon-separated list.
|
||||
If a compiled magic file is found alongside a file or directory, it will be used instead.
|
||||
.It Fl n , -no-buffer
|
||||
Force stdout to be flushed after checking each file.
|
||||
This is only useful if checking a list of files.
|
||||
@ -312,38 +310,27 @@ the output. This does not affect the separator which is still printed.
|
||||
Print a help message and exit.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width /usr/share/misc/magic.mime.mgc -compact
|
||||
.It Pa /usr/share/misc/magic.mgc
|
||||
Default compiled list of magic numbers
|
||||
.It Pa /usr/share/misc/magic
|
||||
Default list of magic numbers
|
||||
.It Pa /usr/share/misc/magic.mime.mgc
|
||||
Default compiled list of magic numbers, used to output mime types when
|
||||
the
|
||||
.Fl i
|
||||
option is specified.
|
||||
.It Pa /usr/share/misc/magic.mime
|
||||
Default list of magic numbers, used to output mime types when the
|
||||
.Fl i
|
||||
option is specified.
|
||||
.Bl -tag -width /usr/local/share/file/magic.mgc -compact
|
||||
.It Pa /usr/local/share/file/magic.mgc
|
||||
Default compiled list of magic.
|
||||
.It Pa /usr/local/share/file/magic
|
||||
Directory containing default magic files.
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
The environment variable
|
||||
.Dv MAGIC
|
||||
can be used to set the default magic number file name.
|
||||
can be used to set the default magic file name.
|
||||
If that variable is set, then
|
||||
.Nm
|
||||
will not attempt to open
|
||||
.Pa $HOME/.magic .
|
||||
.Nm
|
||||
adds
|
||||
.Dq .mime
|
||||
and/or
|
||||
.Dq .mgc
|
||||
to the value of this variable as appropriate.
|
||||
The environment variable
|
||||
.Dv POSIXLY_CORRECT
|
||||
controls (on systems that support symbolic links), if
|
||||
controls (on systems that support symbolic links), whether
|
||||
.Nm
|
||||
will attempt to follow symlinks or not. If set, then
|
||||
.Nm
|
||||
@ -354,10 +341,11 @@ and
|
||||
.Fl h
|
||||
options.
|
||||
.Sh SEE ALSO
|
||||
.Xr magic 5 ,
|
||||
.Xr magic 4 ,
|
||||
.Xr strings 1 ,
|
||||
.Xr od 1 ,
|
||||
.Xr hexdump 1
|
||||
.Xr hexdump 1,
|
||||
.Xr file 1posix
|
||||
.Sh STANDARDS CONFORMANCE
|
||||
This program is believed to exceed the System V Interface Definition
|
||||
of FILE(CMD), as near as one can determine from the vague language
|
||||
@ -420,7 +408,7 @@ If your old
|
||||
command uses a magic file,
|
||||
keep the old magic file around for comparison purposes
|
||||
(rename it to
|
||||
.Pa /usr/share/misc/magic.orig ).
|
||||
.Pa /usr/local/share/file/magic.orig ).
|
||||
.Sh EXAMPLES
|
||||
.Bd -literal -offset indent
|
||||
$ file file.c obj/file /dev/wd0a
|
||||
@ -429,6 +417,33 @@ obj/file: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
|
||||
for NetBSD 4.99.12, dynamically linked (uses shared libs),
|
||||
not stripped
|
||||
/dev/wd0a: block special (0/0)
|
||||
<<<<<<< file.1
|
||||
=======
|
||||
/dev/hda: block special (3/0)
|
||||
|
||||
$ file -s /dev/wd0{b,d}
|
||||
/dev/wd0b: data
|
||||
/dev/wd0d: x86 boot sector
|
||||
|
||||
$ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
|
||||
/dev/hda: x86 boot sector
|
||||
/dev/hda1: Linux/i386 ext2 filesystem
|
||||
/dev/hda2: x86 boot sector
|
||||
/dev/hda3: x86 boot sector, extended partition table
|
||||
/dev/hda4: Linux/i386 ext2 filesystem
|
||||
/dev/hda5: Linux/i386 swap file
|
||||
/dev/hda6: Linux/i386 swap file
|
||||
/dev/hda7: Linux/i386 swap file
|
||||
/dev/hda8: Linux/i386 swap file
|
||||
/dev/hda9: empty
|
||||
/dev/hda10: empty
|
||||
|
||||
$ file -i file.c file /dev/{wd0a,hda}
|
||||
file.c: text/x-c
|
||||
file: application/x-executable
|
||||
/dev/hda: application/x-not-regular-file
|
||||
/dev/wd0a: application/x-not-regular-file
|
||||
>>>>>>> 1.1.1.14
|
||||
|
||||
# file -s /dev/rwd0[abe]
|
||||
/dev/rwd0a: x86 boot sector, BSD disklabel
|
||||
@ -457,7 +472,7 @@ command in every
|
||||
.Dv UNIX since at least Research Version 4
|
||||
(man page dated November, 1973).
|
||||
The System V version introduced one significant major change:
|
||||
the external list of magic number types.
|
||||
the external list of magic types.
|
||||
This slowed the program down slightly but made it a lot more flexible.
|
||||
.Pp
|
||||
This program, based on the System V version,
|
||||
@ -478,17 +493,23 @@ Christos Zoulas (christos@astron.com).
|
||||
Altered by Chris Lowth, chris@lowth.com, 2000:
|
||||
Handle the
|
||||
.Fl i
|
||||
option to output mime type strings and using an alternative
|
||||
option to output mime type strings, using an alternative
|
||||
magic file and internal logic.
|
||||
.Pp
|
||||
Altered by Eric Fischer (enf@pobox.com), July, 2000,
|
||||
to identify character codes and attempt to identify the languages
|
||||
of non-ASCII files.
|
||||
.Pp
|
||||
The list of contributors to the "Magdir" directory (source for the
|
||||
.Pa /usr/share/misc/magic
|
||||
file) is too long to include here.
|
||||
Altered by Reuben Thomas (rrt@sc3d.org), 2007 to 2008, to improve MIME
|
||||
support and merge MIME and non-MIME magic, support directories as well
|
||||
as files of magic, apply many bug fixes and improve the build system.
|
||||
.Pp
|
||||
The list of contributors to the
|
||||
.Dq magic
|
||||
directory (magic files)
|
||||
is too long to include here.
|
||||
You know who you are; thank you.
|
||||
Many contributors are listed in the source files.
|
||||
.Sh LEGAL NOTICE
|
||||
Copyright (c) Ian F. Darwin, Toronto, Canada, 1986-1999.
|
||||
Covered by the standard Berkeley Software Distribution copyright; see the file
|
||||
@ -502,17 +523,10 @@ were written by John Gilmore from his public-domain
|
||||
.Xr tar 1
|
||||
program, and are not covered by the above license.
|
||||
.Sh BUGS
|
||||
.Pp
|
||||
There must be a better way to automate the construction of the Magic
|
||||
file from all the glop in Magdir.
|
||||
What is it?
|
||||
.\" Compilation support has been done
|
||||
.\" Better yet, the magic file should be compiled into binary (say,
|
||||
.\" .Xr ndbm 3
|
||||
.\" or, better yet, fixed-length
|
||||
.\" .Dv 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, with the flexibility of the System V version.
|
||||
.Pp
|
||||
.Nm
|
||||
uses several algorithms that favor speed over accuracy,
|
||||
@ -522,31 +536,6 @@ files.
|
||||
.Pp
|
||||
The support for text files (primarily for programming languages)
|
||||
is simplistic, inefficient and requires recompilation to update.
|
||||
.\" Else support has been done
|
||||
.\" There should be an
|
||||
.\" .Dv else
|
||||
.\" clause to follow a series of continuation lines.
|
||||
.\" .Pp
|
||||
.\" Regular expression support has been done
|
||||
.\" The magic file and keywords should have regular expression support.
|
||||
Their use of
|
||||
.Dv ASCII TAB
|
||||
as a field delimiter is ugly and makes
|
||||
it hard to edit the files, but is entrenched.
|
||||
.Pp
|
||||
It might be advisable to allow upper-case letters in keywords
|
||||
for e.g.,
|
||||
.Xr troff 1
|
||||
commands vs man page macros.
|
||||
Regular expression support would make this easy.
|
||||
.Pp
|
||||
The program doesn't grok
|
||||
.Dv FORTRAN .
|
||||
It should be able to figure
|
||||
.Dv FORTRAN
|
||||
by seeing some keywords which
|
||||
appear indented at the start of line.
|
||||
Regular expression support would make this easy.
|
||||
.Pp
|
||||
The list of keywords in
|
||||
.Dv ascmagic
|
||||
@ -555,11 +544,6 @@ This could be done by using some keyword like
|
||||
.Sq *
|
||||
for the offset value.
|
||||
.Pp
|
||||
.\" Sorting has been done.
|
||||
.\" Another optimization would be to sort
|
||||
.\" the magic file so that we can just run down all the
|
||||
.\" tests for the first byte, first word, first long, etc, once we
|
||||
.\" have fetched it.
|
||||
Complain about conflicts in the magic file entries.
|
||||
Make a rule that the magic entries sort based on file offset rather
|
||||
than position within the magic file?
|
||||
@ -579,10 +563,10 @@ versus
|
||||
Still, if the others don't pan out, it should be possible to use the
|
||||
first guess.
|
||||
.Pp
|
||||
This program is slower than some vendors' file commands.
|
||||
The new support for multiple character codes makes it even slower.
|
||||
.Pp
|
||||
This manual page, and particularly this section, is too long.
|
||||
.Sh RETURN CODE
|
||||
.Nm
|
||||
returns 0 on success, and non-zero on error.
|
||||
.Sh AVAILABILITY
|
||||
You can obtain the original author's latest version by anonymous FTP
|
||||
on
|
||||
|
42
dist/file/doc/libmagic.3
vendored
42
dist/file/doc/libmagic.3
vendored
@ -1,4 +1,5 @@
|
||||
.\" $NetBSD: libmagic.3,v 1.8 2007/06/07 11:32:45 pooka Exp $
|
||||
.\" $NetBSD: libmagic.3,v 1.9 2008/08/30 11:39:01 christos Exp $
|
||||
.\" $File: libmagic.man,v 1.18 2008/02/28 22:24:46 rrt Exp $
|
||||
.\"
|
||||
.\" Copyright (c) Christos Zoulas 2003.
|
||||
.\" All Rights Reserved.
|
||||
@ -68,7 +69,7 @@ These functions
|
||||
operate on the magic database file
|
||||
which is described
|
||||
in
|
||||
.Xr magic 5 .
|
||||
.Xr magic 4 .
|
||||
.Pp
|
||||
The function
|
||||
.Fn magic_open
|
||||
@ -88,8 +89,10 @@ If the file is compressed, unpack it and look at the contents.
|
||||
.It Dv MAGIC_DEVICES
|
||||
If the file is a block or character special device, then open the device
|
||||
and try to look in its contents.
|
||||
.It Dv MAGIC_MIME
|
||||
Return a mime string, instead of a textual description.
|
||||
.It Dv MAGIC_MIME_TYPE
|
||||
Return a MIME type string, instead of a textual description.
|
||||
.It Dv MAGIC_MIME_ENCODING
|
||||
Return a MIME encoding, instead of a textual description.
|
||||
.It Dv MAGIC_CONTINUE
|
||||
Return all matches, not just the first.
|
||||
.It Dv MAGIC_CHECK
|
||||
@ -130,7 +133,7 @@ Don't look for troff sequences inside ascii files.
|
||||
The
|
||||
.Fn magic_close
|
||||
function closes the
|
||||
.Xr magic 5
|
||||
.Xr magic 4
|
||||
database and deallocates any resources used.
|
||||
.Pp
|
||||
The
|
||||
@ -163,9 +166,10 @@ bytes size.
|
||||
.Pp
|
||||
The
|
||||
.Fn magic_setflags
|
||||
function, sets the
|
||||
function sets the
|
||||
.Ar flags
|
||||
described above.
|
||||
described above. Note that using both MIME flags together can also
|
||||
return extra information on the charset.
|
||||
.Pp
|
||||
The
|
||||
.Fn magic_check
|
||||
@ -183,7 +187,9 @@ separated list of database files passed in as
|
||||
or NULL for the default database. It returns 0 on success and -1 on
|
||||
failure. The compiled files created are named from the
|
||||
.Xr basename 1
|
||||
of each file argument with ".mgc" appended to it.
|
||||
of each file argument with
|
||||
.Dq .mgc
|
||||
appended to it.
|
||||
.Pp
|
||||
The
|
||||
.Fn magic_load
|
||||
@ -194,10 +200,14 @@ or NULL for the default database file
|
||||
before any magic queries can performed.
|
||||
.Pp
|
||||
The default database file is named by the MAGIC environment variable. If
|
||||
that variable is not set, the default database file name is /usr/share/misc/magic.
|
||||
that variable is not set, the default database file name is /usr/local/share/file/magic.
|
||||
.Pp
|
||||
.Fn magic_load
|
||||
adds ".mime" and/or ".mgc" to the database filename as appropriate.
|
||||
adds
|
||||
.Dq .mime
|
||||
and/or
|
||||
.Dq .mgc
|
||||
to the database filename as appropriate.
|
||||
.Sh RETURN VALUES
|
||||
The function
|
||||
.Fn magic_open
|
||||
@ -228,19 +238,19 @@ when
|
||||
.Dv MAGIC_PRESERVE_ATIME
|
||||
is set.
|
||||
.Sh FILES
|
||||
.Bl -tag -width /usr/share/misc/magic.mime.mgc -compact
|
||||
.It Pa /usr/share/misc/magic.mime
|
||||
.Bl -tag -width /usr/local/share/file/magic.mime.mgc -compact
|
||||
.It Pa /usr/local/share/file/magic.mime
|
||||
The non-compiled default magic mime database.
|
||||
.It Pa /usr/share/misc/magic.mime.mgc
|
||||
.It Pa /usr/local/share/file/magic.mime.mgc
|
||||
The compiled default magic mime database.
|
||||
.It Pa /usr/share/misc/magic
|
||||
.It Pa /usr/local/share/file/magic
|
||||
The non-compiled default magic database.
|
||||
.It Pa /usr/share/misc/magic.mgc
|
||||
.It Pa /usr/local/share/file/magic.mgc
|
||||
The compiled default magic database.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr file 1 ,
|
||||
.Xr magic 5
|
||||
.Xr magic 4
|
||||
.Sh AUTHORS
|
||||
Måns Rullgård Initial libmagic implementation,
|
||||
and configuration.
|
||||
|
209
dist/file/doc/magic.5
vendored
209
dist/file/doc/magic.5
vendored
@ -1,34 +1,33 @@
|
||||
.\" $NetBSD: magic.5,v 1.15 2007/06/07 11:32:45 pooka Exp $
|
||||
.\" $NetBSD: magic.5,v 1.16 2008/08/30 11:39:01 christos Exp $
|
||||
.\"
|
||||
.\" $File: magic.man,v 1.38 2007/01/27 00:52:08 ljt Exp $
|
||||
.Dd January 10, 2007
|
||||
.\" $File: magic.man,v 1.57 2008/08/30 09:50:20 christos Exp $
|
||||
.Dd August 30, 2008
|
||||
.Dt MAGIC 5
|
||||
.Os
|
||||
.\" install as magic.4 on USG, magic.5 on V7 or Berkeley systems.
|
||||
.\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
|
||||
.Sh NAME
|
||||
.Nm magic
|
||||
.Nd file command's magic number file
|
||||
.Nd file command's magic pattern file
|
||||
.Sh DESCRIPTION
|
||||
This manual page documents the format of the magic file as
|
||||
used by the
|
||||
.Xr file 1
|
||||
command, version 4.21.
|
||||
command, version 4.26.
|
||||
The
|
||||
.Xr file 1
|
||||
command identifies the type of a file using,
|
||||
among other tests,
|
||||
a test for whether the file begins with a certain
|
||||
.Dq "magic number" .
|
||||
a test for whether the file contains certain
|
||||
.Dq "magic patterns" .
|
||||
The file
|
||||
.Pa /usr/share/misc/magic
|
||||
specifies what magic numbers are to be tested for,
|
||||
what message to print if a particular magic number is found,
|
||||
.Pa /usr/local/share/file/magic
|
||||
specifies what patterns are to be tested for, what message or
|
||||
MIME type to print if a particular pattern is found,
|
||||
and additional information to extract from the file.
|
||||
.Pp
|
||||
Each line of the file specifies a test to be performed.
|
||||
A test compares the data starting at a particular offset
|
||||
in the file with a 1-byte, 2-byte, or 4-byte numeric value or
|
||||
a string.
|
||||
in the file with a byte value, a string or a numeric value.
|
||||
If the test succeeds, a message is printed.
|
||||
The line consists of the following fields:
|
||||
.Bl -tag -width ".Dv message"
|
||||
@ -42,11 +41,15 @@ The possible values are:
|
||||
.It Dv byte
|
||||
A one-byte value.
|
||||
.It Dv short
|
||||
A two-byte value (on most systems) in this machine's native byte order.
|
||||
A two-byte value in this machine's native byte order.
|
||||
.It Dv long
|
||||
A four-byte value (on most systems) in this machine's native byte order.
|
||||
A four-byte value in this machine's native byte order.
|
||||
.It Dv quad
|
||||
An eight-byte value (on most systems) in this machine's native byte order.
|
||||
An eight-byte value in this machine's native byte order.
|
||||
.It Dv float
|
||||
A 32-bit single precision IEEE floating point number in this machine's native byte order.
|
||||
.It Dv double
|
||||
A 64-bit double precision IEEE floating point number in this machine's native byte order.
|
||||
.It Dv string
|
||||
A string of bytes.
|
||||
The string type specification can be optionally followed
|
||||
@ -67,10 +70,10 @@ Finally the
|
||||
.Dq c
|
||||
flag, specifies case insensitive matching: lowercase
|
||||
characters in the magic match both lower and upper case characters in the
|
||||
targer, whereas upper case characters in the magic, only much uppercase
|
||||
target, whereas upper case characters in the magic only match uppercase
|
||||
characters in the target.
|
||||
.It Dv pstring
|
||||
A pascal style string where the first byte is interpreted as the an
|
||||
A Pascal-style string where the first byte is interpreted as the an
|
||||
unsigned length.
|
||||
The string is not NUL terminated.
|
||||
.It Dv date
|
||||
@ -84,98 +87,119 @@ local time rather than UTC.
|
||||
An eight-byte value interpreted as a UNIX-style date, but interpreted as
|
||||
local time rather than UTC.
|
||||
.It Dv beshort
|
||||
A two-byte value (on most systems) in big-endian byte order.
|
||||
A two-byte value in big-endian byte order.
|
||||
.It Dv belong
|
||||
A four-byte value (on most systems) in big-endian byte order.
|
||||
A four-byte value in big-endian byte order.
|
||||
.It Dv bequad
|
||||
An eight-byte value (on most systems) in big-endian byte order.
|
||||
An eight-byte value in big-endian byte order.
|
||||
.It Dv befloat
|
||||
A 32-bit single precision IEEE floating point number in big-endian byte order.
|
||||
.It Dv bedouble
|
||||
A 64-bit double precision IEEE floating point number in big-endian byte order.
|
||||
.It Dv bedate
|
||||
A four-byte value (on most systems) in big-endian byte order,
|
||||
A four-byte value in big-endian byte order,
|
||||
interpreted as a Unix date.
|
||||
.It Dv beqdate
|
||||
An eight-byte value (on most systems) in big-endian byte order,
|
||||
An eight-byte value in big-endian byte order,
|
||||
interpreted as a Unix date.
|
||||
.It Dv beldate
|
||||
A four-byte value (on most systems) in big-endian byte order,
|
||||
A four-byte value in big-endian byte order,
|
||||
interpreted as a UNIX-style date, but interpreted as local time rather
|
||||
than UTC.
|
||||
.It Dv beqldate
|
||||
An eight-byte value (on most systems) in big-endian byte order,
|
||||
An eight-byte value in big-endian byte order,
|
||||
interpreted as a UNIX-style date, but interpreted as local time rather
|
||||
than UTC.
|
||||
.It Dv bestring16
|
||||
A two-byte unicode (UCS16) string in big-endian byte order.
|
||||
.It Dv leshort
|
||||
A two-byte value (on most systems) in little-endian byte order.
|
||||
A two-byte value in little-endian byte order.
|
||||
.It Dv lelong
|
||||
A four-byte value (on most systems) in little-endian byte order.
|
||||
A four-byte value in little-endian byte order.
|
||||
.It Dv lequad
|
||||
An eight-byte value (on most systems) in little-endian byte order.
|
||||
An eight-byte value in little-endian byte order.
|
||||
.It Dv lefloat
|
||||
A 32-bit single precision IEEE floating point number in little-endian byte order.
|
||||
.It Dv ledouble
|
||||
A 64-bit double precision IEEE floating point number in little-endian byte order.
|
||||
.It Dv ledate
|
||||
A four-byte value (on most systems) in little-endian byte order,
|
||||
A four-byte value in little-endian byte order,
|
||||
interpreted as a UNIX date.
|
||||
.It Dv leqdate
|
||||
An eight-byte value (on most systems) in little-endian byte order,
|
||||
An eight-byte value in little-endian byte order,
|
||||
interpreted as a UNIX date.
|
||||
.It Dv leldate
|
||||
A four-byte value (on most systems) in little-endian byte order,
|
||||
A four-byte value in little-endian byte order,
|
||||
interpreted as a UNIX-style date, but interpreted as local time rather
|
||||
than UTC.
|
||||
.It Dv leqldate
|
||||
An eight-byte value (on most systems) in little-endian byte order,
|
||||
An eight-byte value in little-endian byte order,
|
||||
interpreted as a UNIX-style date, but interpreted as local time rather
|
||||
than UTC.
|
||||
.It Dv lestring16
|
||||
A two-byte unicode (UCS16) string in little-endian byte order.
|
||||
.It Dv melong
|
||||
A four-byte value (on most systems) in middle-endian (PDP-11) byte order.
|
||||
A four-byte value in middle-endian (PDP-11) byte order.
|
||||
.It Dv medate
|
||||
A four-byte value (on most systems) in middle-endian (PDP-11) byte order,
|
||||
A four-byte value in middle-endian (PDP-11) byte order,
|
||||
interpreted as a UNIX date.
|
||||
.It Dv meldate
|
||||
A four-byte value (on most systems) in middle-endian (PDP-11) byte order,
|
||||
A four-byte value in middle-endian (PDP-11) byte order,
|
||||
interpreted as a UNIX-style date, but interpreted as local time rather
|
||||
than UTC.
|
||||
.It Dv regex
|
||||
A regular expression match in extended POSIX regular expression syntax
|
||||
(much like egrep).
|
||||
The type specification can be optionally followed by /[cse]*.
|
||||
(like egrep). Regular expressions can take exponential time to
|
||||
process, and their performance is hard to predict, so their use is
|
||||
discouraged. When used in production environments, their performance
|
||||
should be carefully checked. The type specification can be optionally
|
||||
followed by
|
||||
.Dv /[c][s] .
|
||||
The
|
||||
.Dq c
|
||||
flag makes the match case insensitive, while the
|
||||
.Dq s
|
||||
or
|
||||
.Dq e
|
||||
flags update the offset to the starting or ending offsets of the
|
||||
match (only one should be used).
|
||||
By default, regex does not update the offset.
|
||||
The regular expression is always tested against the first
|
||||
flag update the offset to the start offset of the match, rather than the end.
|
||||
The regular expression is tested against line
|
||||
.Dv N + 1
|
||||
onwards, where
|
||||
.Dv N
|
||||
lines, where
|
||||
.Dv N
|
||||
is the given offset, thus it
|
||||
is only useful for (single-byte encoded) text.
|
||||
is the given offset.
|
||||
Line endings are assumed to be in the machine's native format.
|
||||
.Dv ^
|
||||
and
|
||||
.Dv $
|
||||
will match the beginning and end of individual lines, respectively,
|
||||
match the beginning and end of individual lines, respectively,
|
||||
not beginning and end of file.
|
||||
.It Dv search
|
||||
A literal string search starting at the given offset.
|
||||
It must be followed by
|
||||
.Dv \*[Lt]number\*[Gt]
|
||||
which specifies how many matches shall be attempted (the range).
|
||||
This is suitable for searching larger binary expressions with variable
|
||||
offsets, using
|
||||
A literal string search starting at the given offset. The same
|
||||
modifier flags can be used as for string patterns. The modifier flags
|
||||
(if any) must be followed by
|
||||
.Dv /number
|
||||
the range, that is, the number of positions at which the match will be
|
||||
attempted, starting from the start offset. This is suitable for
|
||||
searching larger binary expressions with variable offsets, using
|
||||
.Dv \e
|
||||
escapes for special characters.
|
||||
escapes for special characters. The offset works as for regex.
|
||||
.It Dv default
|
||||
This is intended to be used with the text
|
||||
.Dv x
|
||||
This is intended to be used with the test
|
||||
.Em x
|
||||
(which is always true) and a message that is to be used if there are
|
||||
no other matches.
|
||||
.El
|
||||
.El
|
||||
.Pp
|
||||
Each top-level magic pattern (see below for an explanation of levels)
|
||||
is classified as text or binary according to the types used. Types
|
||||
.Dq regex
|
||||
and
|
||||
.Dq search
|
||||
are classified as text tests, unless non-printable characters are used
|
||||
in the pattern. All other tests are classified as binary. A top-level
|
||||
pattern is considered to be a test text when all its patterns are text
|
||||
patterns; otherwise, it is considered to be a binary pattern. When
|
||||
matching a file, binary patterns are tried first; if no match is
|
||||
found, and the file looks like text, then its encoding is determined
|
||||
and the text patterns are tried.
|
||||
.Pp
|
||||
The numeric types may optionally be followed by
|
||||
.Dv \*[Am]
|
||||
@ -185,7 +209,6 @@ numeric value before any comparisons are done.
|
||||
Prepending a
|
||||
.Dv u
|
||||
to the type indicates that ordered comparisons should be unsigned.
|
||||
.Bl -tag -width ".Dv message"
|
||||
.It Dv test
|
||||
The value to be compared with the value from the file.
|
||||
If the type is
|
||||
@ -216,12 +239,14 @@ the value specified after is negated before tested.
|
||||
to specify that any value will match.
|
||||
If the character is omitted, it is assumed to be
|
||||
.Dv = .
|
||||
For all tests except
|
||||
.Em string
|
||||
Operators
|
||||
.Dv \*[Am] ,
|
||||
.Dv ^ ,
|
||||
and
|
||||
.Em regex ,
|
||||
operation
|
||||
.Dv !
|
||||
.Dv ~
|
||||
don't work with floats and doubles.
|
||||
The operator
|
||||
.Dv !\&
|
||||
specifies that the line matches if the test does
|
||||
.Em not
|
||||
succeed.
|
||||
@ -234,8 +259,8 @@ is octal, and
|
||||
.Dv 0x13
|
||||
is hexadecimal.
|
||||
.Pp
|
||||
For string values, the byte string from the
|
||||
file must match the specified byte string.
|
||||
For string values, the string from the
|
||||
file must match the specified string.
|
||||
The operators
|
||||
.Dv = ,
|
||||
.Dv \*[Lt]
|
||||
@ -246,10 +271,10 @@ and
|
||||
can be applied to strings.
|
||||
The length used for matching is that of the string argument
|
||||
in the magic file.
|
||||
This means that a line can match any string, and
|
||||
then presumably print that string, by doing
|
||||
This means that a line can match any non-empty string (usually used to
|
||||
then print the string), with
|
||||
.Em \*[Gt]\e0
|
||||
(because all strings are greater than the null string).
|
||||
(because all non-empty strings are greater than the empty string).
|
||||
.Pp
|
||||
The special test
|
||||
.Em x
|
||||
@ -260,11 +285,44 @@ If the string contains a
|
||||
.Xr printf 3
|
||||
format specification, the value from the file (with any specified masking
|
||||
performed) is printed using the message as the format string.
|
||||
If the string begins with ``\\b'', the message printed is the
|
||||
remainder of the string with no whitespace added before it: multiple
|
||||
matches are normally separated by a single space.
|
||||
If the string begins with
|
||||
.Dq \eb ,
|
||||
the message printed is the remainder of the string with no whitespace
|
||||
added before it: multiple matches are normally separated by a single
|
||||
space.
|
||||
.El
|
||||
.Pp
|
||||
A MIME type is given on a separate line, which must be the next
|
||||
non-blank or comment line after the magic line that identifies the
|
||||
file type, and has the following format:
|
||||
.Bd -literal -offset indent
|
||||
!:mime MIMETYPE
|
||||
.Ed
|
||||
.Pp
|
||||
i.e. the literal string
|
||||
.Dq !:mime
|
||||
followed by the MIME type.
|
||||
.Pp
|
||||
An optional strength can be supplied on a separate line which refers to
|
||||
the current magic description using the following format:
|
||||
.Bd -literal -offset indent
|
||||
!:strength OP VALUE
|
||||
.Ed
|
||||
.Pp
|
||||
The operand
|
||||
.Dv OP
|
||||
can be:
|
||||
.Dv + ,
|
||||
.Dv - ,
|
||||
.Dv * ,
|
||||
or
|
||||
.Dv /
|
||||
and
|
||||
.Dv VALUE
|
||||
is a constant between 0 and 255.
|
||||
This constant is applied using the specified operand
|
||||
to the currently computed default magic strength.
|
||||
.Pp
|
||||
Some file formats contain additional information which is to be printed
|
||||
along with the file type or need additional tests to determine the true
|
||||
file type.
|
||||
@ -334,13 +392,13 @@ That way variable length structures can be examined:
|
||||
\*[Gt]\*[Gt](0x3c.l) string LX\e0\e0 LX executable (OS/2)
|
||||
.Ed
|
||||
.Pp
|
||||
This strategy of examining has one drawback: You must make sure that
|
||||
This strategy of examining has a drawback: You must make sure that
|
||||
you eventually print something, or users may get empty output (like, when
|
||||
there is neither PE\e0\e0 nor LE\e0\e0 in the above example)
|
||||
.Pp
|
||||
If this indirect offset cannot be used as-is, there are simple calculations
|
||||
If this indirect offset cannot be used directly, simple calculations are
|
||||
possible: appending
|
||||
.Em [+-*/%\*[Am]|^]\*[Lt]number\*[Gt]
|
||||
.Em [+-*/%\*[Am]|^]number
|
||||
inside parentheses allows one to modify
|
||||
the value read from the file before it is used as an offset:
|
||||
.Bd -literal -offset indent
|
||||
@ -452,4 +510,3 @@ a system on which the lengths are invariant.
|
||||
.\" the changes I posted to the S5R2 version.
|
||||
.\"
|
||||
.\" Modified for Ian Darwin's version of the file command.
|
||||
.\" @(#)Id: magic.man,v 1.38 2007/01/27 00:52:08 ljt Exp
|
||||
|
Loading…
Reference in New Issue
Block a user