FILETYPE(5) K-AShare by Xinet (10/14/99 10.1) FILETYPE(5)
NAME [Toc] [Back]
filetype - K-AShare's filetype specification file
DESCRIPTION [Toc] [Back]
The katype(1) and ksd(1m) commands identify the type of a
file using, among other tests, a test for whether the file
begins with a certain magic number. The file
/usr/adm/appletalk/filetype specifies the magic numbers and
other test being applied. The tests determine the proper
type of the native UNIX files for the Macintosh AFP client.
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. The first test that gives a positive result will
determine the filetype. The line consists of the following
fields:
offset
A number specifying the offset, in bytes, into the file
of the data which is to be tested.
type The type of the data to be tested. The possible
values:
byte A one-byte value
short A two-byte value (in big-endian byte order)
long A four-byte value (in big-endian byte
order)
string A string of bytes
suffix A filename suffix (file.c, file.o)
builtin A special built-in type. Some tests are
hard built into the algorithm, since they
are too difficult to specify in another
way.
test The value to be compared with the value from the file.
If the type is numeric, this value is specified in C
form; if it is a string, it is specified as a C string
with the usual escapes permitted (e.g., \n for newline).
Numeric values
The value may be preceded by a character
indicating the operation to be performed.
It may be =, to specify that the value from
the file must equal the specified value; <,
Page 1 (printed 5/4/100)
FILETYPE(5) K-AShare by Xinet (10/14/99 10.1) FILETYPE(5)
to specify that the value from the file
must be less than the specified value; >,
to specify that the value from the file
must be greater than the specified value;
or &, to specify that the value is to be
AND'ed with the numeric value (which is
true if any bits in the value are on in the
file). The < and > comparisons are signed
comparisons for short and long values, and
unsigned for bytes. Numeric values are
specified in C form; e.g., 13 is decimal,
013 is octal, and 0x13 is hexadecimal. If
the character is omitted, it is assumed to
be =.
string values
The byte string from the file must match
the specified byte string. The operators =,
< and > (but not &) can be applied to
strings. The length used for matching is
that of the string argument in the filetype
file.
Values for current known built-in types:
troff
Makefile
C-src
assembler-src
Pascal-src
English
mail
tar
ascii
escaped-ascii
default
The value default should always be specified. The
offset field is ignored when the built-in keyword is
used. Some of these are actually not all that useful.
Fields
Here we specify the field which K-AShare will assign to
the file. There are two colon delimited fields, as in
``:TEXT:uxtt:''. The first field will become the
FileType field, while the second one will become the
FileCreator field.
Note that in general, the first test which succeeds will
win; so the ordering of the specifications is important.
For example, if the specification of a .c suffix is before a
line specifying .chess, file.chess will be categorized as a
file.c. To prevent this, one should have the .chess
Page 2 (printed 5/4/100)
FILETYPE(5) K-AShare by Xinet (10/14/99 10.1) FILETYPE(5)
specification first.
A line which begins with the character > indicates
additional tests and messages to be printed. If the test on
the line preceding the first line with a > succeeds, the
tests specified in all the subsequent lines beginning with >
are performed, and the type and creator field is assigned
for the last test which succeeds. Tests may be nested in
deeper levels by prepending more > characters. The next
line starting with a lesser number of > characters
terminates this.
FILES [Toc] [Back]
/usr/adm/appletalk/filetype
SEE ALSO [Toc] [Back]
katype(1), ksd(1m) - the commands that use this file.
Page 3 (printed 5/4/100)
[ Back ]
|