[w3m-dev 03945] Re: application/xhtml+xml support

* Makefile.in (ETC_DIR): added
	(CONF_DIR): added
	(DEFS): add CONF_DIR
	(MAKE_ARGS): add CONF_DIR
* config.h.in (SYS_MAILCAP): use CONF_DIR
	(SYS_URIMETHODMAP): use CONF_DIR
* func.c (sys_current_keymap_file): added
	(interpret_keymap): added
	(initKeymap): use interpret_keymap
	(interpret_mouse_action): added
	(initMouseAction): use interpret_mouse_action
* indep.c (w3m_conf_dir): added
* indep.h (w3m_conf_dir): added
* menu.c (interpret_menu): added
	(initMenu): use interpret_menu
* proto.h (confFile): added
* rc.c (init_rc): read config file by interpret_rc
	(confFile): added
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
Fumitoshi UKAI
2003-07-26 17:16:24 +00:00
parent e6c62de50c
commit c913794f0c
9 changed files with 140 additions and 64 deletions
+23 -1
View File
@@ -1,3 +1,25 @@
2003-07-27 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03945] Re: application/xhtml+xml support
* Makefile.in (ETC_DIR): added
(CONF_DIR): added
(DEFS): add CONF_DIR
(MAKE_ARGS): add CONF_DIR
* config.h.in (SYS_MAILCAP): use CONF_DIR
(SYS_URIMETHODMAP): use CONF_DIR
* func.c (sys_current_keymap_file): added
(interpret_keymap): added
(initKeymap): use interpret_keymap
(interpret_mouse_action): added
(initMouseAction): use interpret_mouse_action
* indep.c (w3m_conf_dir): added
* indep.h (w3m_conf_dir): added
* menu.c (interpret_menu): added
(initMenu): use interpret_menu
* proto.h (confFile): added
* rc.c (init_rc): read config file by interpret_rc
(confFile): added
2003-07-23 Takahashi Youichirou <nikuq@hk.airnet.ne.jp> 2003-07-23 Takahashi Youichirou <nikuq@hk.airnet.ne.jp>
* [w3m-dev 03942] Save history * [w3m-dev 03942] Save history
@@ -7961,4 +7983,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1 * release-0-2-1
* import w3m-0.2.1 * import w3m-0.2.1
$Id: ChangeLog,v 1.855 2003/07/22 17:29:47 ukai Exp $ $Id: ChangeLog,v 1.856 2003/07/26 17:16:24 ukai Exp $
+6 -2
View File
@@ -28,12 +28,15 @@ CGIBIN_DIR = $(libexecdir)/$(package)/cgi-bin
AUXBIN_DIR = $(libexecdir)/$(package) AUXBIN_DIR = $(libexecdir)/$(package)
HELP_DIR = $(datadir)/$(package) HELP_DIR = $(datadir)/$(package)
RC_DIR = ~/.$(package) RC_DIR = ~/.$(package)
ETC_DIR = $(sysconfdir)
CONF_DIR = $(sysconfdir)/$(package)
CFLAGS = $(OPTS) @CFLAGS@ $(DEFS) CFLAGS = $(OPTS) @CFLAGS@ $(DEFS)
CPPFLAGS = @CPPFLAGS@ CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@ -I. -I$(top_srcdir) -DAUXBIN_DIR=\"$(AUXBIN_DIR)\" \ DEFS = @DEFS@ -I. -I$(top_srcdir) -DAUXBIN_DIR=\"$(AUXBIN_DIR)\" \
-DLIB_DIR=\"$(CGIBIN_DIR)\" -DHELP_DIR=\"$(HELP_DIR)\" \ -DLIB_DIR=\"$(CGIBIN_DIR)\" -DHELP_DIR=\"$(HELP_DIR)\" \
-DETC_DIR=\"$(sysconfdir)\" -DRC_DIR=\"$(RC_DIR)\" -DETC_DIR=\"$(ETC_DIR)\" -DCONF_DIR=\"$(CONF_DIR)\" \
-DRC_DIR=\"$(RC_DIR)\"
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBS = -L. -lindep @LIBS@ LIBS = -L. -lindep @LIBS@
W3M_LIBS = @W3M_LIBS@ W3M_LIBS = @W3M_LIBS@
@@ -41,7 +44,8 @@ W3M_LIBS = @W3M_LIBS@
MAKE_ARGS = PERL='$(PERL)' MKDIR='$(MKDIR)' INSTALL='$(INSTALL)' \ MAKE_ARGS = PERL='$(PERL)' MKDIR='$(MKDIR)' INSTALL='$(INSTALL)' \
BIN_DIR='$(bindir)' AUXBIN_DIR='$(AUXBIN_DIR)' \ BIN_DIR='$(bindir)' AUXBIN_DIR='$(AUXBIN_DIR)' \
LIB_DIR='$(CGIBIN_DIR)' \ LIB_DIR='$(CGIBIN_DIR)' \
HELP_DIR='$(HELP_DIR)' MAN_DIR='$(mandir)' ETC_DIR='$(sysconfdir)' \ HELP_DIR='$(HELP_DIR)' MAN_DIR='$(mandir)' ETC_DIR='$(ETC_DIR)' \
CONF_DIR='$(CONF_DIR)' \
RC_DIR='$(RC_DIR)' DESTDIR='$(DESTDIR)' KEYBIND_SRC='$(KEYBIND_SRC)' RC_DIR='$(RC_DIR)' DESTDIR='$(DESTDIR)' KEYBIND_SRC='$(KEYBIND_SRC)'
IMGCFLAGS = @IMGX11CFLAGS@ @IMGFBCFLAGS@ IMGCFLAGS = @IMGX11CFLAGS@ @IMGFBCFLAGS@
+3 -4
View File
@@ -12,7 +12,6 @@
#define IMGDISPLAY "w3mimgdisplay" #define IMGDISPLAY "w3mimgdisplay"
#define XFACE2XPM "xface2xpm" #define XFACE2XPM "xface2xpm"
#define RC_DIR "~/.w3m"
#define BOOKMARK "bookmark.html" #define BOOKMARK "bookmark.html"
#define CONFIG_FILE "config" #define CONFIG_FILE "config"
#define KEYMAP_FILE "keymap" #define KEYMAP_FILE "keymap"
@@ -24,11 +23,11 @@
#define PASSWD_FILE RC_DIR "/passwd" #define PASSWD_FILE RC_DIR "/passwd"
#define PRE_FORM_FILE RC_DIR "/pre_form" #define PRE_FORM_FILE RC_DIR "/pre_form"
#define USER_MAILCAP RC_DIR "/mailcap" #define USER_MAILCAP RC_DIR "/mailcap"
#define SYS_MAILCAP ETC_DIR "mailcap" #define SYS_MAILCAP CONF_DIR "/mailcap"
#define USER_MIMETYPES "~/.mime.types" #define USER_MIMETYPES "~/.mime.types"
#define SYS_MIMETYPES ETC_DIR "mime.types" #define SYS_MIMETYPES ETC_DIR "/mime.types"
#define USER_URIMETHODMAP RC_DIR "/urimethodmap" #define USER_URIMETHODMAP RC_DIR "/urimethodmap"
#define SYS_URIMETHODMAP ETC_DIR "/urimethodmap" #define SYS_URIMETHODMAP CONF_DIR "/urimethodmap"
#define DEF_SAVE_FILE "index.html" #define DEF_SAVE_FILE "index.html"
+54 -29
View File
@@ -1,4 +1,4 @@
/* $Id: func.c,v 1.22 2002/12/04 17:15:35 ukai Exp $ */ /* $Id: func.c,v 1.23 2003/07/26 17:16:24 ukai Exp $ */
/* /*
* w3m func.c * w3m func.c
*/ */
@@ -15,6 +15,7 @@
#define KEYDATA_HASH_SIZE 16 #define KEYDATA_HASH_SIZE 16
static Hash_iv *keyData = NULL; static Hash_iv *keyData = NULL;
static char keymap_initialized = FALSE; static char keymap_initialized = FALSE;
static struct stat sys_current_keymap_file;
static struct stat current_keymap_file; static struct stat current_keymap_file;
void void
@@ -108,26 +109,25 @@ setKeymap(char *p, int lineno, int verbose)
putHash_iv(keyData, c, NULL); putHash_iv(keyData, c, NULL);
} }
void static void
initKeymap(int force) interpret_keymap(FILE *kf, struct stat *current, int force)
{ {
FILE *kf; int fd;
struct stat kstat;
Str line; Str line;
char *p, *s, *emsg; char *p, *s, *emsg;
int lineno; int lineno;
int verbose = 1; int verbose = 1;
int fd;
struct stat kstat;
extern int str_to_bool(char *value, int old); extern int str_to_bool(char *value, int old);
if ((kf = fopen(rcFile(keymap_file), "rt")) == NULL || if ((fd = fileno(kf)) < 0 || fstat(fd, &kstat) ||
((fd = fileno(kf)) < 0 || fstat(fd, &kstat) || (!force &&
(!force && keymap_initialized && kstat.st_mtime == current->st_mtime &&
kstat.st_mtime == current_keymap_file.st_mtime && kstat.st_dev == current->st_dev &&
kstat.st_dev == current_keymap_file.st_dev && kstat.st_ino == current->st_ino &&
kstat.st_ino == current_keymap_file.st_ino && kstat.st_size == current->st_size))
kstat.st_size == current_keymap_file.st_size)))
return; return;
*current = kstat;
lineno = 0; lineno = 0;
while (!feof(kf)) { while (!feof(kf)) {
@@ -157,8 +157,23 @@ initKeymap(int force)
} }
setKeymap(p, lineno, verbose); setKeymap(p, lineno, verbose);
} }
fclose(kf); }
current_keymap_file = kstat;
void
initKeymap(int force)
{
FILE *kf;
if ((kf = fopen(confFile(KEYMAP_FILE), "rt")) != NULL) {
interpret_keymap(kf, &sys_current_keymap_file,
force || !keymap_initialized);
fclose(kf);
}
if ((kf = fopen(rcFile(keymap_file), "rt")) != NULL) {
interpret_keymap(kf, &current_keymap_file,
force || !keymap_initialized);
fclose(kf);
}
keymap_initialized = TRUE; keymap_initialized = TRUE;
} }
@@ -506,24 +521,13 @@ setMouseAction2(MouseActionMap * map, char *p)
map->data = s; map->data = s;
} }
void static void
initMouseAction(void) interpret_mouse_action(FILE *mf)
{ {
FILE *mf;
Str line; Str line;
char *p, *s; char *p, *s;
int b; int b;
bcopy((void *)&default_mouse_action, (void *)&mouse_action,
sizeof(default_mouse_action));
mouse_action.lastline_map[0] = New_N(MouseActionMap, 6);
bcopy((void *)&default_lastline_action,
(void *)mouse_action.lastline_map[0],
sizeof(default_lastline_action));
if ((mf = fopen(rcFile(MOUSE_FILE), "rt")) == NULL)
return;
while (!feof(mf)) { while (!feof(mf)) {
line = Strfgets(mf); line = Strfgets(mf);
Strchop(line); Strchop(line);
@@ -577,6 +581,27 @@ initMouseAction(void)
else if (!strcasecmp(s, "tab")) else if (!strcasecmp(s, "tab"))
setMouseAction2(&mouse_action.tab_map[b], p); setMouseAction2(&mouse_action.tab_map[b], p);
} }
fclose(mf); }
void
initMouseAction(void)
{
FILE *mf;
bcopy((void *)&default_mouse_action, (void *)&mouse_action,
sizeof(default_mouse_action));
mouse_action.lastline_map[0] = New_N(MouseActionMap, 6);
bcopy((void *)&default_lastline_action,
(void *)mouse_action.lastline_map[0],
sizeof(default_lastline_action));
if ((mf = fopen(confFile(MOUSE_FILE), "rt")) != NULL) {
interpret_mouse_action(mf);
fclose(mf);
}
if ((mf = fopen(rcFile(MOUSE_FILE), "rt")) != NULL) {
interpret_mouse_action(mf);
fclose(mf);
}
} }
#endif #endif
+7 -1
View File
@@ -1,4 +1,4 @@
/* $Id: indep.c,v 1.33 2003/04/07 16:27:10 ukai Exp $ */ /* $Id: indep.c,v 1.34 2003/07/26 17:16:24 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <stdio.h> #include <stdio.h>
#include <pwd.h> #include <pwd.h>
@@ -732,6 +732,12 @@ w3m_etc_dir()
return w3m_dir("W3M_ETC_DIR", ETC_DIR); return w3m_dir("W3M_ETC_DIR", ETC_DIR);
} }
char *
w3m_conf_dir()
{
return w3m_dir("W3M_CONF_DIR", CONF_DIR);
}
char * char *
w3m_help_dir() w3m_help_dir()
{ {
+2 -1
View File
@@ -1,4 +1,4 @@
/* $Id: indep.h,v 1.14 2003/04/07 16:27:10 ukai Exp $ */ /* $Id: indep.h,v 1.15 2003/07/26 17:16:24 ukai Exp $ */
#ifndef INDEP_H #ifndef INDEP_H
#define INDEP_H #define INDEP_H
#include <gc.h> #include <gc.h>
@@ -68,6 +68,7 @@ extern char *shell_quote(char *str);
extern char *w3m_auxbin_dir(); extern char *w3m_auxbin_dir();
extern char *w3m_lib_dir(); extern char *w3m_lib_dir();
extern char *w3m_etc_dir(); extern char *w3m_etc_dir();
extern char *w3m_conf_dir();
extern char *w3m_help_dir(); extern char *w3m_help_dir();
#define New(type) ((type*)GC_MALLOC(sizeof(type))) #define New(type) ((type*)GC_MALLOC(sizeof(type)))
+32 -24
View File
@@ -1,4 +1,4 @@
/* $Id: menu.c,v 1.31 2003/02/05 16:44:00 ukai Exp $ */ /* $Id: menu.c,v 1.32 2003/07/26 17:16:24 ukai Exp $ */
/* /*
* w3m menu.c * w3m menu.c
*/ */
@@ -1669,32 +1669,14 @@ optionMenu(int x, int y, char **label, int *variable, int initial,
/* --- InitMenu --- */ /* --- InitMenu --- */
void static void
initMenu(void) interpret_menu(FILE *mf)
{ {
FILE *mf;
Str line; Str line;
char *p, *s; char *p, *s;
int in_menu, nmenu = 0, nitem = 0, type; int in_menu = 0, nmenu = 0, nitem = 0, type;
MenuItem *item = NULL; MenuItem *item = NULL;
MenuList *list;
w3mMenuList = New_N(MenuList, 3);
w3mMenuList[0].id = "Main";
w3mMenuList[0].menu = &MainMenu;
w3mMenuList[0].item = MainMenuItem;
w3mMenuList[1].id = "Select";
w3mMenuList[1].menu = &SelectMenu;
w3mMenuList[1].item = NULL;
w3mMenuList[2].id = "SelectTab";
w3mMenuList[2].menu = &SelTabMenu;
w3mMenuList[2].item = NULL;
w3mMenuList[3].id = NULL;
if ((mf = fopen(rcFile(MENU_FILE), "rt")) == NULL)
goto create_menu;
in_menu = 0;
while (!feof(mf)) { while (!feof(mf)) {
line = Strfgets(mf); line = Strfgets(mf);
Strchop(line); Strchop(line);
@@ -1734,9 +1716,35 @@ initMenu(void)
item[nitem].type = MENU_END; item[nitem].type = MENU_END;
} }
} }
fclose(mf); }
void
initMenu(void)
{
FILE *mf;
MenuList *list;
w3mMenuList = New_N(MenuList, 3);
w3mMenuList[0].id = "Main";
w3mMenuList[0].menu = &MainMenu;
w3mMenuList[0].item = MainMenuItem;
w3mMenuList[1].id = "Select";
w3mMenuList[1].menu = &SelectMenu;
w3mMenuList[1].item = NULL;
w3mMenuList[2].id = "SelectTab";
w3mMenuList[2].menu = &SelTabMenu;
w3mMenuList[2].item = NULL;
w3mMenuList[3].id = NULL;
if ((mf = fopen(confFile(MENU_FILE), "rt")) != NULL) {
interpret_menu(mf);
fclose(mf);
}
if ((mf = fopen(rcFile(MENU_FILE), "rt")) != NULL) {
interpret_menu(mf);
fclose(mf);
}
create_menu:
for (list = w3mMenuList; list->id != NULL; list++) { for (list = w3mMenuList; list->id != NULL; list++) {
if (list->item == NULL) if (list->item == NULL)
continue; continue;
+2 -1
View File
@@ -1,4 +1,4 @@
/* $Id: proto.h,v 1.94 2003/07/22 17:33:16 ukai Exp $ */ /* $Id: proto.h,v 1.95 2003/07/26 17:16:24 ukai Exp $ */
/* /*
* This file was automatically generated by version 1.7 of cextract. * This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended. * Manual editing not recommended.
@@ -580,6 +580,7 @@ extern void panel_set_option(struct parsed_tagarg *);
extern void sync_with_option(void); extern void sync_with_option(void);
extern char *rcFile(char *base); extern char *rcFile(char *base);
extern char *etcFile(char *base); extern char *etcFile(char *base);
extern char *confFile(char *base);
extern char *auxbinFile(char *base); extern char *auxbinFile(char *base);
extern char *libFile(char *base); extern char *libFile(char *base);
extern char *helpFile(char *base); extern char *helpFile(char *base);
+11 -1
View File
@@ -1,4 +1,4 @@
/* $Id: rc.c,v 1.84 2003/04/08 16:01:40 ukai Exp $ */ /* $Id: rc.c,v 1.85 2003/07/26 17:16:24 ukai Exp $ */
/* /*
* Initialization file etc. * Initialization file etc.
*/ */
@@ -1397,6 +1397,10 @@ init_rc(void)
interpret_rc(f); interpret_rc(f);
fclose(f); fclose(f);
} }
if ((f = fopen(confFile(CONFIG_FILE), "rt")) != NULL) {
interpret_rc(f);
fclose(f);
}
if ((f = fopen(config_file, "rt")) != NULL) { if ((f = fopen(config_file, "rt")) != NULL) {
interpret_rc(f); interpret_rc(f);
fclose(f); fclose(f);
@@ -1584,6 +1588,12 @@ etcFile(char *base)
return expandPath(Strnew_m_charp(w3m_etc_dir(), "/", base, NULL)->ptr); return expandPath(Strnew_m_charp(w3m_etc_dir(), "/", base, NULL)->ptr);
} }
char *
confFile(char *base)
{
return expandPath(Strnew_m_charp(w3m_conf_dir(), "/", base, NULL)->ptr);
}
#ifndef USE_HELP_CGI #ifndef USE_HELP_CGI
char * char *
helpFile(char *base) helpFile(char *base)