Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/majn/tgl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVysheng <mail@vysheng.ru>2014-11-19 15:45:40 +0300
committerVysheng <mail@vysheng.ru>2014-11-19 15:45:40 +0300
commita1a7a5900647a5d0c7c19035699ac15e34ba4da7 (patch)
treec7e46ffd2f18fdf2d13fdcd62a4420d90623414c /tg-mime-types.c
parentb79a6fcc99553f5303d3f32cbc48ca61de7bd333 (diff)
Probably works on apple
Diffstat (limited to 'tg-mime-types.c')
-rw-r--r--tg-mime-types.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tg-mime-types.c b/tg-mime-types.c
index 43c26c3..7f7b353 100644
--- a/tg-mime-types.c
+++ b/tg-mime-types.c
@@ -2,11 +2,30 @@
#include <assert.h>
#define MAX_MIME_TYPES_NUM 10000
+
+#ifdef __APPLE__
+#include <mach-o/getsect.h>
+
+extern char _section$__DATA_auto_mime_types[];
+static char *start = _section$__DATA_auto_mime_types[];
+static char *end = _section$__DATA__auto_mime_types + getsectbyname("__DATA", "_auto_mime_types")->size
+
+#elif (defined __WIN32__) /* mingw */
+
+extern char binary_auto_mime_types_start[];
+extern char binary_auto_mime_types_end[];
+static char *start = binary_auto_mime_types_start;
+static char *end = binary_auto_mime_types_start;
+
+#else /* gnu ld */
+
extern char _binary_auto_mime_types_start[];
extern char _binary_auto_mime_types_end[];
static char *start = _binary_auto_mime_types_start;
static char *end = _binary_auto_mime_types_start;
+#endif
+
char *tg_mime_by_filename (const char *filename) {
int l = strlen (filename);
const char *p = filename - 1 + l;