[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Identifying file types.



unless you see drawbacks, i think you should use file magic to id file types.
that is the canonical unix way of doing it.

the command `file <filename>` interfaces to a [enormous] file magic database
which fairly reliably id's any file you care to deal with.
you might call `file` directly from your program (quick and dirty), or
open the `file` src and interface directly to the routines it uses (nicer,
but harder to write and maintain).  if we're lucky, we can alter file to
put it's db-iface code in a shared library, and have file, help, and anything
else all able to use that.

for more info, see file(1), magic(4), and the "file" rpm and src.

-luka