Index: fm.h =================================================================== RCS file: /home/okabe/CVS_DB/w3m/fm.h,v retrieving revision 1.7.2.7 diff -u -r1.7.2.7 fm.h --- fm.h 2000/10/25 10:03:32 1.7.2.7 +++ fm.h 2000/10/25 16:13:50 @@ -671,10 +671,12 @@ global struct cookie *First_cookie init(NULL); #endif /* USE_COOKIE */ -global struct mailcap *UserMailcap; -global struct mailcap *SysMailcap; -global struct table2 *UserMimeTypes; -global struct table2 *SysMimeTypes; +global struct mailcap **UserMailcap; +global struct table2 **UserMimeTypes; +global TextList *mailcap_list; +global TextList *mimetypes_list; +global char *mailcap_files init(USER_MAILCAP ", " SYS_MAILCAP); +global char *mimetypes_files init(USER_MIMETYPES ", " SYS_MIMETYPES); global TextList *fileToDelete; @@ -727,6 +729,7 @@ global int is_redisplay init(FALSE); global int clear_buffer init(TRUE); global double pixel_per_char init(DEFAULT_PIXEL_PER_CHAR); + /* * Externals */ Index: mailcap.c =================================================================== RCS file: /home/okabe/CVS_DB/w3m/mailcap.c,v retrieving revision 1.3 diff -u -r1.3 mailcap.c --- mailcap.c 2000/10/06 15:39:17 1.3 +++ mailcap.c 2000/10/25 15:39:52 @@ -16,12 +16,18 @@ void initMailcap() { - UserMailcap = loadMailcap(USER_MAILCAP); -#ifdef __EMX__ - SysMailcap = loadMailcap(get_os2_dft("SYS_MAILCAP", "/mptn/etc/mailcap")); -#else - SysMailcap = loadMailcap(SYS_MAILCAP); -#endif + int i; + TextListItem *tl; + + if (non_null(mailcap_files)) + mailcap_list = make_domain_list(mailcap_files); + else + mailcap_list = NULL; + if (mailcap_list == NULL) + return; + UserMailcap = New_N(struct mailcap *, mailcap_list->nitem); + for (i = 0, tl = mailcap_list->first; tl; i++, tl = tl->next) + UserMailcap[i] = loadMailcap(tl->ptr); } int @@ -228,14 +234,18 @@ searchExtViewer(char *type) { struct mailcap *p; - p = searchMailcap(UserMailcap, type); - if (p == NULL) { - p = searchMailcap(SysMailcap, type); - if (p == NULL) { - p = searchMailcap(DefaultMailcap, type); - } + int i; + + if (mailcap_list == NULL) + goto no_user_mailcap; + + for (i = 0; i < mailcap_list->nitem; i++) { + if (p = searchMailcap(UserMailcap[i], type)) + return p; } - return p; + + no_user_mailcap: + return searchMailcap(DefaultMailcap, type); } #define MC_NORMAL 0 Index: rc.c =================================================================== RCS file: /home/okabe/CVS_DB/w3m/rc.c,v retrieving revision 1.3.4.6 diff -u -r1.3.4.6 rc.c --- rc.c 2000/10/24 05:02:15 1.3.4.6 +++ rc.c 2000/10/25 16:11:50 @@ -82,6 +82,8 @@ #define CMT_CGIBIN "/cgi-bin で表されるディレクトリ" #define CMT_CONFIRM_QQ "q での終了時に確認する" #define CMT_SHOW_NUM "行番号を表示する" +#define CMT_MIMETYPES "利用する mime.types" +#define CMT_MAILCAP "利用する mailcap" #define CMT_EDITOR "利用するエディタ" #define CMT_MAILER "利用するメーラ" #define CMT_EXTBRZ "外部ブラウザ" @@ -159,6 +161,8 @@ #define CMT_CGIBIN "Directory corresponds to /cgi-bin" #define CMT_CONFIRM_QQ "Confirm when quitting with q" #define CMT_SHOW_NUM "Show line number" +#define CMT_MIMETYPES "mime.types files" +#define CMT_MAILCAP "mailcap files" #define CMT_EDITOR "Editor" #define CMT_MAILER "Mailer" #define CMT_EXTBRZ "External Browser" @@ -362,6 +366,8 @@ struct param_ptr params6[] = { + {"mime_types", P_STRING, PI_TEXT, (void *) &mimetypes_files, CMT_MIMETYPES, NULL}, + {"mailcap", P_STRING, PI_TEXT, (void *) &mailcap_files, CMT_MAILCAP, NULL}, {"editor", P_STRING, PI_TEXT, (void *) &Editor, CMT_EDITOR, NULL}, {"mailer", P_STRING, PI_TEXT, (void *) &Mailer, CMT_MAILER, NULL}, {"extbrowser", P_STRING, PI_TEXT, (void *) &ExtBrowser, CMT_EXTBRZ, NULL}, @@ -851,8 +857,18 @@ void initMimeTypes() { - UserMimeTypes = loadMimeTypes(USER_MIMETYPES); - SysMimeTypes = loadMimeTypes(SYS_MIMETYPES); + 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 @@ -1057,6 +1073,8 @@ resizeHist(URLHist, URLHistSize + 1); #endif /* USE_HISTORY */ WrapSearch = WrapDefault; + initMailcap(); + initMimeTypes(); backBf(); } Index: url.c =================================================================== RCS file: /home/okabe/CVS_DB/w3m/url.c,v retrieving revision 1.6.2.4 diff -u -r1.6.2.4 url.c --- url.c 2000/10/24 04:11:56 1.6.2.4 +++ url.c 2000/10/25 15:42:27 @@ -1462,13 +1462,19 @@ guessContentType(char *filename) { char *ret; + int i; if (filename == NULL) return NULL; - if ((ret = guessContentTypeFromTable(UserMimeTypes, filename)) != NULL) - return ret; - if ((ret = guessContentTypeFromTable(SysMimeTypes, filename)) != NULL) - return ret; + if (mimetypes_list == NULL) + goto no_user_mimetypes; + + for (i = 0; i < mimetypes_list->nitem; i++) { + if (ret = guessContentTypeFromTable(UserMimeTypes[i], filename)) + return ret; + } + + no_user_mimetypes: return guessContentTypeFromTable(DefaultGuess, filename); }