aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-07-26 17:16:24 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-07-26 17:16:24 +0000
commitc913794f0cdf4baf33c195eb7700b7d75d24537f (patch)
tree5821a81f4872e6272db6cf4ac0d872744588fd8e
parentfix indent (diff)
downloadw3m-c913794f0cdf4baf33c195eb7700b7d75d24537f.tar.gz
w3m-c913794f0cdf4baf33c195eb7700b7d75d24537f.zip
[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>
Diffstat (limited to '')
-rw-r--r--ChangeLog24
-rw-r--r--Makefile.in8
-rw-r--r--config.h.in7
-rw-r--r--func.c83
-rw-r--r--indep.c8
-rw-r--r--indep.h3
-rw-r--r--menu.c56
-rw-r--r--proto.h3
-rw-r--r--rc.c12
9 files changed, 140 insertions, 64 deletions
diff --git a/ChangeLog b/ChangeLog
index 3dbeacb..1bff498 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* [w3m-dev 03942] Save history
@@ -7961,4 +7983,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-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 $
diff --git a/Makefile.in b/Makefile.in
index dc35b2f..52adad3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -28,12 +28,15 @@ CGIBIN_DIR = $(libexecdir)/$(package)/cgi-bin
AUXBIN_DIR = $(libexecdir)/$(package)
HELP_DIR = $(datadir)/$(package)
RC_DIR = ~/.$(package)
+ETC_DIR = $(sysconfdir)
+CONF_DIR = $(sysconfdir)/$(package)
CFLAGS = $(OPTS) @CFLAGS@ $(DEFS)
CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@ -I. -I$(top_srcdir) -DAUXBIN_DIR=\"$(AUXBIN_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@
LIBS = -L. -lindep @LIBS@
W3M_LIBS = @W3M_LIBS@
@@ -41,7 +44,8 @@ W3M_LIBS = @W3M_LIBS@
MAKE_ARGS = PERL='$(PERL)' MKDIR='$(MKDIR)' INSTALL='$(INSTALL)' \
BIN_DIR='$(bindir)' AUXBIN_DIR='$(AUXBIN_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)'
IMGCFLAGS = @IMGX11CFLAGS@ @IMGFBCFLAGS@
diff --git a/config.h.in b/config.h.in
index e58c796..2ecf454 100644
--- a/config.h.in
+++ b/config.h.in
@@ -12,7 +12,6 @@
#define IMGDISPLAY "w3mimgdisplay"
#define XFACE2XPM "xface2xpm"
-#define RC_DIR "~/.w3m"
#define BOOKMARK "bookmark.html"
#define CONFIG_FILE "config"
#define KEYMAP_FILE "keymap"
@@ -24,11 +23,11 @@
#define PASSWD_FILE RC_DIR "/passwd"
#define PRE_FORM_FILE RC_DIR "/pre_form"
#define USER_MAILCAP RC_DIR "/mailcap"
-#define SYS_MAILCAP ETC_DIR "mailcap"
+#define SYS_MAILCAP CONF_DIR "/mailcap"
#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 SYS_URIMETHODMAP ETC_DIR "/urimethodmap"
+#define SYS_URIMETHODMAP CONF_DIR "/urimethodmap"
#define DEF_SAVE_FILE "index.html"
diff --git a/func.c b/func.c
index ebd2923..300d451 100644
--- a/func.c
+++ b/func.c
@@ -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
*/
@@ -15,6 +15,7 @@
#define KEYDATA_HASH_SIZE 16
static Hash_iv *keyData = NULL;
static char keymap_initialized = FALSE;
+static struct stat sys_current_keymap_file;
static struct stat current_keymap_file;
void
@@ -108,26 +109,25 @@ setKeymap(char *p, int lineno, int verbose)
putHash_iv(keyData, c, NULL);
}
-void
-initKeymap(int force)
+static void
+interpret_keymap(FILE *kf, struct stat *current, int force)
{
- FILE *kf;
+ int fd;
+ struct stat kstat;
Str line;
char *p, *s, *emsg;
int lineno;
int verbose = 1;
- int fd;
- struct stat kstat;
extern int str_to_bool(char *value, int old);
- if ((kf = fopen(rcFile(keymap_file), "rt")) == NULL ||
- ((fd = fileno(kf)) < 0 || fstat(fd, &kstat) ||
- (!force && keymap_initialized &&
- kstat.st_mtime == current_keymap_file.st_mtime &&
- kstat.st_dev == current_keymap_file.st_dev &&
- kstat.st_ino == current_keymap_file.st_ino &&
- kstat.st_size == current_keymap_file.st_size)))
+ if ((fd = fileno(kf)) < 0 || fstat(fd, &kstat) ||
+ (!force &&
+ kstat.st_mtime == current->st_mtime &&
+ kstat.st_dev == current->st_dev &&
+ kstat.st_ino == current->st_ino &&
+ kstat.st_size == current->st_size))
return;
+ *current = kstat;
lineno = 0;
while (!feof(kf)) {
@@ -157,8 +157,23 @@ initKeymap(int force)
}
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;
}
@@ -506,24 +521,13 @@ setMouseAction2(MouseActionMap * map, char *p)
map->data = s;
}
-void
-initMouseAction(void)
+static void
+interpret_mouse_action(FILE *mf)
{
- FILE *mf;
Str line;
char *p, *s;
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)) {
line = Strfgets(mf);
Strchop(line);
@@ -577,6 +581,27 @@ initMouseAction(void)
else if (!strcasecmp(s, "tab"))
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
diff --git a/indep.c b/indep.c
index c057aca..53c2876 100644
--- a/indep.c
+++ b/indep.c
@@ -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 <stdio.h>
#include <pwd.h>
@@ -733,6 +733,12 @@ w3m_etc_dir()
}
char *
+w3m_conf_dir()
+{
+ return w3m_dir("W3M_CONF_DIR", CONF_DIR);
+}
+
+char *
w3m_help_dir()
{
return w3m_dir("W3M_HELP_DIR", HELP_DIR);
diff --git a/indep.h b/indep.h
index b44fb1a..c977a86 100644
--- a/indep.h
+++ b/indep.h
@@ -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
#define INDEP_H
#include <gc.h>
@@ -68,6 +68,7 @@ extern char *shell_quote(char *str);
extern char *w3m_auxbin_dir();
extern char *w3m_lib_dir();
extern char *w3m_etc_dir();
+extern char *w3m_conf_dir();
extern char *w3m_help_dir();
#define New(type) ((type*)GC_MALLOC(sizeof(type)))
diff --git a/menu.c b/menu.c
index a2f0759..7c3e15a 100644
--- a/menu.c
+++ b/menu.c
@@ -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
*/
@@ -1669,32 +1669,14 @@ optionMenu(int x, int y, char **label, int *variable, int initial,
/* --- InitMenu --- */
-void
-initMenu(void)
+static void
+interpret_menu(FILE *mf)
{
- FILE *mf;
Str line;
char *p, *s;
- int in_menu, nmenu = 0, nitem = 0, type;
+ int in_menu = 0, nmenu = 0, nitem = 0, type;
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)) {
line = Strfgets(mf);
Strchop(line);
@@ -1734,9 +1716,35 @@ initMenu(void)
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++) {
if (list->item == NULL)
continue;
diff --git a/proto.h b/proto.h
index 006eb43..e64917e 100644
--- a/proto.h
+++ b/proto.h
@@ -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.
* Manual editing not recommended.
@@ -580,6 +580,7 @@ extern void panel_set_option(struct parsed_tagarg *);
extern void sync_with_option(void);
extern char *rcFile(char *base);
extern char *etcFile(char *base);
+extern char *confFile(char *base);
extern char *auxbinFile(char *base);
extern char *libFile(char *base);
extern char *helpFile(char *base);
diff --git a/rc.c b/rc.c
index d9eed46..67ec95b 100644
--- a/rc.c
+++ b/rc.c
@@ -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.
*/
@@ -1397,6 +1397,10 @@ init_rc(void)
interpret_rc(f);
fclose(f);
}
+ if ((f = fopen(confFile(CONFIG_FILE), "rt")) != NULL) {
+ interpret_rc(f);
+ fclose(f);
+ }
if ((f = fopen(config_file, "rt")) != NULL) {
interpret_rc(f);
fclose(f);
@@ -1584,6 +1588,12 @@ etcFile(char *base)
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
char *
helpFile(char *base)