Initial commit (squashed)

This commit is contained in:
2019-09-27 22:56:07 -04:00
commit 564a17a8fa
75 changed files with 7518 additions and 0 deletions

20
src/parsing/mime.c Normal file
View File

@@ -0,0 +1,20 @@
#include "mime.h"
unsigned int mime_get_mime_by_ext(GHashTable *ext_table, const char * ext) {
char lower[64];
char *p = lower;
while ((*ext)) {
*p++ = (char)tolower(*ext++);
}
*p = '\0';
return (size_t) g_hash_table_lookup(ext_table, lower);
}
unsigned int mime_get_mime_by_string(GHashTable *mime_table, const char * str) {
const char * ptr = str;
while (*ptr == ' ' || *ptr == '[') {
ptr++;
}
return (size_t) g_hash_table_lookup(mime_table, ptr);
}