DSBMime is an easy to use, fast C library to identify the MIME type of files.
0.1.1
# tar xf libdsbmime-0.1.1.tgz && cd libdsbmime-0.1.1 && make install
LIBRARY MIME type determining library (libdsbmime, -ldsbmime) SYNOPSIS #include <dsbmime.h> int dsbmime_init(void); char * dsbmime_get_type(const char *file); void dsbmime_cleanup(void); DESCRIPTION libdsbmime is a C library to identify a file's MIME type by using freedesktop.org's Shared MIME database package. Before using any other function of the library, dsbmime_init() must be called. The function dsbmime_get_type() returns the MIME type of the given file as a string stored in a static buffer. Subsequent calls to the same function will modify that buffer. In order to free memory used by the library, the function dsbmime_cleanup() can be called. RETURN VALUES dsbmime_init() returns -1 if an error has occurred, else 0. dsbmime_get_type() returns a pointer to a string containing the file's MIME type, or NULL if the file type could not be determined. If an error has occurred, NULL is returned and errno is set. FILES /usr/local/share/mime/globs2 /usr/local/share/mime/magic