tags 267803 +patch
thanks

As indicated in the file(1) manual page, the format of the magic
database is described in the magic(5) manual page.

However, be warned that file(1) is not very good at handling various
heuristics. You really do need something like a "magic marker" somewhere
in the file for the detection to be accurate and reliable.

Having said that, some Info files do contain something resembling a
magic marker, namely a mode indicator for Emacs. Thus, the attached
magic snippet should be able to detect at least some fraction of Info
files, at least enough to offer a workaround for those who need one.

(None of the Info files on my system contain this marker, though, save
for the "dir" entries which I believe are automatically generated. All
the Debian info pages are gzipped anyway.)

This could be generalized to handle any text file with a -*- mode -*-
indicator, but that would mess up things, because you'd like the
detection strings to be consistent In other words, C code should not
display as "ASCII C text" but as "ASCII C program text" because that's
what file(1) currently displays for other C files; but a generalized
solution would have to know for each detected mode whether it's
"program" text or some other kind. So it would not be very general after
all.

/* era */

-- 
If this were a real .signature, it would suck less.  Well, maybe not.

Attachment: info.magic
Description: Binary data

Reply via email to