diff options
Diffstat (limited to 'rc.c')
-rw-r--r-- | rc.c | 69 |
1 files changed, 1 insertions, 68 deletions
@@ -1,4 +1,4 @@ -/* $Id: rc.c,v 1.17 2001/11/30 04:52:57 ukai Exp $ */ +/* $Id: rc.c,v 1.18 2001/11/30 09:54:22 ukai Exp $ */ /* * Initialization file etc. */ @@ -1072,73 +1072,6 @@ do_mkdir(const char *dir, long mode) #define do_mkdir(dir,mode) mkdir(dir,mode) #endif /* not __EMX__ */ -struct table2 * -loadMimeTypes(char *filename) -{ - FILE *f; - char *d, *type; - int i, n; - Str tmp; - struct table2 *mtypes; - - f = fopen(expandName(filename), "r"); - if (f == NULL) - return NULL; - n = 0; - while (tmp = Strfgets(f), tmp->length > 0) { - d = tmp->ptr; - if (d[0] != '#') { - d = strtok(d, " \t\n\r"); - if (d != NULL) { - d = strtok(NULL, " \t\n\r"); - for (i = 0; d != NULL; i++) - d = strtok(NULL, " \t\n\r"); - n += i; - } - } - } - fseek(f, 0, 0); - mtypes = New_N(struct table2, n + 1); - i = 0; - while (tmp = Strfgets(f), tmp->length > 0) { - d = tmp->ptr; - if (d[0] == '#') - continue; - type = strtok(d, " \t\n\r"); - if (type == NULL) - continue; - while (1) { - d = strtok(NULL, " \t\n\r"); - if (d == NULL) - break; - mtypes[i].item1 = Strnew_charp(d)->ptr; - mtypes[i].item2 = Strnew_charp(type)->ptr; - i++; - } - } - mtypes[i].item1 = NULL; - mtypes[i].item2 = NULL; - fclose(f); - return mtypes; -} - -void -initMimeTypes() -{ - int i; - TextListItem *tl; - - if (non_null(mimetypes_files)) - mimetypes_list = make_domain_list(mimetypes_files); - else - mimetypes_list = NULL; - if (mimetypes_list == NULL) - return; - UserMimeTypes = New_N(struct table2 *, mimetypes_list->nitem); - for (i = 0, tl = mimetypes_list->first; tl; i++, tl = tl->next) - UserMimeTypes[i] = loadMimeTypes(tl->ptr); -} - void sync_with_option(void) { |