NOTMAGIC(3C) COMMAND REFERENCE NOTMAGIC(3C)
NAME
notmagic - interface to magic number file
SYNOPSIS
int notmagic (magnum)
long magnum;
DESCRIPTION
The file /usr/lib/magic contains a list of magic numbers
which describe various special files such as object files,
compacted data files, and archives. The subroutine notmagic
gets the magic numbers for files that are definitely not
text files, and compares them against magnum to see if the
file is not a text file.
The normal way to use notmagic is to read the first 32 bits
of the file and give them to notmagic in the proper order
for your system's byte ordering.
The first time notmagic is called, a table is built from the
magic number file. This table is saved for further calls to
notmagic.
See RETURN VALUE for the meaning of the return values.
FILES
/usr/lib/magic
The file containing magic number information.
RETURN VALUE
The possible return values from notmagic are:
0 If the characters given match a magic number.
1 If the characters given do not match a magic
number.
-1 If the magic number file cannot be opened. In this
case, the subroutine ERROR(3c) should be called
with an exit code of P_ERR or P_WARN.
-2 If the magic number descriptions contain obvious
errors. The command file(1) should be used to
diagnose the problem.
CAVEATS
The only information taken from the magic number file is
from lines whose magic numbers are not of type string, and
only those lines which begin with a 0.
The parameter passed to notmagic is expected to be the first
32 bits in the file.
Printed 3/13/89 1
NOTMAGIC(3C) COMMAND REFERENCE NOTMAGIC(3C)
Due to some special restrictions, the programs in the ex
editor family (which includes vi) use a special version of
notmagic which can only handle up to 300 magic numbers of
type long and/or short.
SEE ALSO
ex(1), file(1), ERROR(3c), and magic(5).
Printed 3/13/89 2
%%index%%
na:360,93;
sy:453,435;
de:888,1280;
fi:2168,163;
rv:2331,762;
ca:3093,433;3958,339;
se:4297,212;
%%index%%000000000130