Administration Guide : Command-line manual pages

FILETYPE(5) manual page


filetype - FullPress filetype specification file


The katype(1) and ksd(8) 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:

A number specifying the offset, in bytes, into the file of the data which is to be tested. If the type of the entry is string, and the test is for equality, the offset may be followed by a comma and another decimal number specifying the number of bytes to scan seaching for the string.
The type of the data to be tested. The possible values:
A one-byte value
A two-byte value (in big-endian byte order)
A four-byte value (in big-endian byte order)
A string of bytes
A filename suffix (file.c, file.o)
A special built-in type. Some tests are hard built into the algorithm, since they are too difficult to specify in another way.
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 new-line).
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; <, 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:


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.

Here we specify the field which FullPress 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 a specification for the string cat is before a line specifying the string catalog (at the same location), catalog will never be chosen. To prevent this, one should have the MORE specific tests first, or use nested entries, described below.

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.



See Also

katype(1) , ksd(8) - the commands that use this file.