определить тип файла (determine file type)
TODO
Fix output so that tests for MIME and APPLE flags are not needed
all over the place, and actual output is only done in one place.
This needs a design. Suggestion: push possible outputs on to a
list, then pick the last-pushed (most specific, one hopes) value at
the end, or use a default if the list is empty. This should not
slow down evaluation.
The handling of MAGIC_CONTINUE and printing \012- between entries
is clumsy and complicated; refactor and centralize.
Some of the encoding logic is hard-coded in encoding.c and can be
moved to the magic files if we had a !:charset annotation.
Continue to squash all magic bugs. See Debian BTS for a good
source.
Store arbitrarily long strings, for example for %s patterns, so
that they can be printed out. Fixes Debian bug #271672. This can
be done by allocating strings in a string pool, storing the string
pool at the end of the magic file and converting all the string
pointers to relative offsets from the string pool.
Add syntax for relative offsets after current level (Debian bug
#466037).
Make file -ki work, i.e. give multiple MIME types.
Add a zip library so we can peek inside Office2007 documents to
print more details about their contents.
Add an option to print URLs for the sources of the file
descriptions.
Combine script searches and add a way to map executable names to
MIME types (e.g. have a magic value for !:mime which causes the
resulting string to be looked up in a table). This would avoid
adding the same magic repeatedly for each new hash-bang
interpreter.
When a file descriptor is available, we can skip and adjust the
buffer instead of the hacky buffer management we do now.
Fix 'name' and 'use' to check for consistency at compile time
(duplicate 'name', 'use' pointing to undefined 'name' ). Make
'name' / 'use' more efficient by keeping a sorted list of names.
Special-case ^ to flip endianness in the parser so that it does not
have to be escaped, and document it.
If the offsets specified internally in the file exceed the buffer
size ( HOWMANY variable in file.h), then we don't seek to that
offset, but we give up. It would be better if buffer managements
was done when the file descriptor is available so we can seek
around the file. One must be careful though because this has
performance and thus security considerations, because one can slow
down things by repeateadly seeking.
There is support now for keeping separate buffers and having
offsets from the end of the file, but the internal buffer
management still needs an overhaul.