Skip to content

mrclksr/libdsbmime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

libdsbmime - Library to determine file types

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.

INSTALLATION

# make install

or if you're not happy with the predefined PREFIX:

# make PREFIX=/somewhere/else install

DEPENDENCIES

libdsbmime needs freedsktop.org's Shared MIME database package.

INSTALLED FILES

${PREFIX}/include/dsbmime.h

Include file

${PREFIX}/lib/libdsbmime.a

Static library file

${PREFIX}/man/man3/libdsbmime.3.gz

Manunal page

EXAMPLES

See test.c

About

Library to determine file types

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published