Re: [LIP] Using libmagic to check file type

Kumar Appaiah <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
On Wed, Jul 15, 2009 at 09:30:12AM +0530, Y Giridhar Appaji Nag wrote:
> I was under the impression that file(1) uses libmagic which inturn reads a
> file of 'magic' patterns for the tests and the same file also has the 'file
> type string' to be printed.
> 
> And looking at libmagic(3)
> 
>   ...
>   The magic_file() function returns a textual description of the contents of
>   the filename argument, or NULL if an error occurred.  If the filename is
>   NULL, then stdin is used.
>   ...

This is my question. Do I have to use this return string, or is there
an enumeration of various file types, say, as integers? The file
program source code just needs the string, since it is a mere wrapper
around the magic_file function.

Thanks.

Kumar
-- 
Kumar Appaiah

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.