libdsbmime - Library to determine file types
#include <dsbmime.h>
int
dsbmime_init(void);
char *
dsbmime_get_type(const char *file);
void
dsbmime_cleanup(void);
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.
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.
# make install
or if you're not happy with the predefined PREFIX:
# make PREFIX=/somewhere/else install
libdsbmime needs freedsktop.org's Shared MIME database package.
${PREFIX}/include/dsbmime.h
Include file
${PREFIX}/lib/libdsbmime.a
Static library file
${PREFIX}/man/man3/libdsbmime.3.gz
Manunal page
See test.c