FILETYPE(5) manual page Name
filetype - FullPress filetype specification fileDescription
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:
- offset
- 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.
- 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.
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.
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.