|
ginnOS
The reference: libc, the libraries and the kernel
|
file types from /usr/share/ginnos/mime.conf. More...
#include "mime.h"#include <fcntl.h>#include <stdlib.h>#include <string.h>#include <sys/stat.h>#include <unistd.h>Macros | |
| #define | CONF_MAX_SIZE (256 * 1024) |
| #define | EXT_MAX 15 |
Enumerations | |
| enum | rule_kind_t { RULE_EXT , RULE_MAGIC , RULE_TEXT } |
Functions | |
| mime_table_t * | mime_from_text (const char *text) |
| a table from text in memory (for tests). | |
| mime_table_t * | mime_open (const char *path) |
| read a table file (MIME_CONF for the system one). | |
| void | mime_close (mime_table_t *table) |
| const mime_type_t * | mime_lookup (const mime_table_t *table, const char *name, const uint8_t *head, size_t head_len) |
| the type of a file from its name and its first bytes. | |
| const mime_type_t * | mime_lookup_file (const mime_table_t *table, const char *path) |
| the type of a file on disk: inode/directory for a directory, else by its name and first bytes. | |
file types from /usr/share/ginnos/mime.conf.
| #define CONF_MAX_SIZE (256 * 1024) |
| #define EXT_MAX 15 |
| enum rule_kind_t |
| mime_table_t * mime_from_text | ( | const char * | text | ) |
a table from text in memory (for tests).
| mime_table_t * mime_open | ( | const char * | path | ) |
read a table file (MIME_CONF for the system one).
| void mime_close | ( | mime_table_t * | table | ) |
| const mime_type_t * mime_lookup | ( | const mime_table_t * | table, |
| const char * | name, | ||
| const uint8_t * | head, | ||
| size_t | head_len ) |
the type of a file from its name and its first bytes.
| name | the file name (a path is fine), or NULL. |
| head | the first bytes of the file, or NULL. |
| const mime_type_t * mime_lookup_file | ( | const mime_table_t * | table, |
| const char * | path ) |
the type of a file on disk: inode/directory for a directory, else by its name and first bytes.