Original Author: Paul L Daniels
Original Release Date: Feb 21, 2003
Sourced From: Xamime -
http://www.xamime.com
URL:
http://www.pldaniels.com/filetype
To install filetype, unzip and untar the file.
bash-3.00$ gunzip filetype-0.1.3.tar.gz
bash-3.00$ tar -xvf filetype-0.1.3.tar
x filetype-0.1.3, 0 bytes, 0 tape blocks
x filetype-0.1.3/filetype.1, 1577 bytes, 4 tape blocks
x filetype-0.1.3/filetype-compile.1, 974 bytes, 2 tape blocks
x filetype-0.1.3/CHANGELOG, 4106 bytes, 9 tape blocks
x filetype-0.1.3/README, 2004 bytes, 4 tape blocks
x filetype-0.1.3/CONTRIBUTORS, 324 bytes, 1 tape blocks
x filetype-0.1.3/LICENSE, 1476 bytes, 3 tape blocks
x filetype-0.1.3/INSTALL, 578 bytes, 2 tape blocks
x filetype-0.1.3/TODO, 216 bytes, 1 tape blocks
x filetype-0.1.3/Makefile, 1122 bytes, 3 tape blocks
x filetype-0.1.3/makefile.vc, 915 bytes, 2 tape blocks
x filetype-0.1.3/filetype.c, 20476 bytes, 40 tape blocks
x filetype-0.1.3/libfiletype.c, 53362 bytes, 105 tape blocks
x filetype-0.1.3/libfiletype.h, 5745 bytes, 12 tape blocks
x filetype-0.1.3/filetype-compile.c, 2076 bytes, 5 tape blocks
x filetype-0.1.3/logger.c, 7723 bytes, 16 tape blocks
x filetype-0.1.3/logger.h, 581 bytes, 2 tape blocks
x filetype-0.1.3/pldstr.c, 21344 bytes, 42 tape blocks
x filetype-0.1.3/pldstr.h, 949 bytes, 2 tape blocks
x filetype-0.1.3/filetype.list, 7875 bytes, 16 tape blocks
Install the file from the root account. To do so, change the
current working directory to the one in which the filetype
files were placed when you extracted them from the tar file,
then run make
and make install
.
If you have problems when you run the make
command
on a Solaris system,
see
Solaris Make Errors.
Expected output from make:
# /usr/ccs/bin/make
cc -Wall -Werror -g -c pldstr.c
cc -Wall -Werror -g -c logger.c
cc -Wall -Werror -g -c libfiletype.c
cc -Wall -Werror -g -c filetype-compile.c
cc -Wall -Werror -g pldstr.o logger.o libfiletype.o filetype-compile.o -o filetype-compile
cc -Wall -Werror -g -c filetype.c
cc -Wall -Werror -g pldstr.o logger.o libfiletype.o filetype.o -o filetype
If you receive a "strip: not found error" message during the make
install
step on a Solaris system, you will need to adjust your path to
include the location of the strip
command.
# make install
make: not found
# /usr/ccs/bin/make install
strip filetype-compile
sh: strip: not found
*** Error code 1
make: Fatal error: Command failed for target `install'
On a Solaris 10 installation on an Intel-based PC, I found strip
in several locations.
# find / -name strip -print
/usr/ccs/bin/amd64/strip
/usr/ccs/bin/strip
/usr/sfw/i386-sun-solaris2.10/bin/strip
/opt/sfw/lib/bin/strip
/opt/sfw/lib/i386-pc-solaris2.10/bin/strip
You can add the /usr/ccs/bin
directory to root's path with
PATH=$PATH:/usr/ccs/bin
.
Once the path is set, you will still encounter another error, because
the cp
command on Solaris doesn't recognize the
-v
option. The -v
option, which is available
on Linux systems, just instructs the copy command to provide verbose
information during the copy process.
# make install
strip filetype-compile
strip filetype
./filetype-compile filetype.list filetype.spec
Reading in text database...
110 types read in...
Clearing database...
Reading in binary database...
110 types read in from binary database
Types database verified.
cp -v filetype filetype-compile /usr/local/bin
cp: illegal option -- v
Usage: cp [-f] [-i] [-p] [-@] f1 f2
cp [-f] [-i] [-p] [-@] f1 ... fn d1
cp -r|-R [-H|-L|-P] [-f] [-i] [-p] [-@] d1 ... dn-1 dn
*** Error code 2
make: Fatal error: Command failed for target `install'
To solve that problem, edit Makefile, which will be in the directory
where you extracted the files from the tar archive. Remove the -v
from the cp -v
lines in the following sections of Makefile.
install: filetype-compile filetype
strip filetype-compile
strip filetype
./filetype-compile filetype.list filetype.spec
cp -v filetype filetype-compile /usr/local/bin
cp -v filetype.spec /etc
cp -v filetype.1 /usr/local/man/man1
cp -v filetype-compile.1 /usr/local/man/man1
validate: filetype filetype-compile
./filetype-compile filetype.list filetype.spec
cp -v filetype.spec validate
cp -v filetype validate
You should then, hopefully, be able to run the make install
command successfully.
# make install
strip filetype-compile
strip filetype
./filetype-compile filetype.list filetype.spec
Reading in text database...
110 types read in...
Clearing database...
Reading in binary database...
110 types read in from binary database
Types database verified.
cp filetype filetype-compile /usr/local/bin
cp filetype.spec /etc
cp filetype.1 /usr/local/man/man1
cp filetype-compile.1 /usr/local/man/man1
You should then be able to use the command to determine a file type for a given file.
# /usr/local/bin/filetype /home/jsmith/av71_en.exe
/home/jsmith/av71_en.exe "DosExe" (.exe DOS EXE)
For many files, the file type information will be similar to what
you would get with the file
command, which is likely
already on your system.
# file /home/jsmith/av71_en.exe
/home/jsmith/av71_en.exe: DOS executable (EXE)
The man file for filetype is placed in /usr/local/man/man1
.
If you get a "No manual entry for filetype" error message when you type
man filetype
, that directory isn't in your man path. You can
access the filetype man file with man -M /usr/local/man filetype
.
User Commands filetype(1)
NAME
filetype - file type reporting program
SYNOPSIS
filetype [ -s filetype-spec file ] [ -h, --help ] [ -v, --
version ] [ -d, --debug ] [ --log-stdout ] [ --log-stderr ]
[ --log-syslog ] [ -f namefile ] file ...
DESCRIPTION
This manual page documents version 0.0.1 of the filetype
command. filetype tries to classify each file given to it.
The file(s) to classify can be given on the command line as
usual file arguments (i.e. after the options), or in a file
where the files to classify are listed on separate lines, or
in standard input. filetype tests against a binary database
with information about file types, which should be located
at /etc/filetype.spec unless you specify otherwise with the
-s option. If the file is known, information about it is
printed on standard output. Otherwise the tag "Unknown" is
used.
OPTIONS
-s filetype-spec file
Use this file to test against rather than the default
/etc/filetype.spec
-h, --help
Show usage.
-v, --version
Show version.
-d, --debug
Print debugging messages (warning: large output)
--log-stdout
Send verbose/debug output to stdout.
--log-stderr
Send verbose/debug output to stderr.
--log-stdout
Send verbose/debug output to stdout.
--log-stderr
Send verbose/debug output to stderr.
--log-syslog
Send verbose/debug output to syslog if available.
-f namefile
A file (or stdin if '-') containing a list of files to
test. Multiple file list can be used by using multiple
'-f file' arguments.
file(1), filetype-compile(1), libfiletype(2).
Developer's Website |
MoonPoint Support |
References: