commit 416d2940ded45f74516f659f3e641d14008e65e3
parent 053ace4e2762b0d352153cbf8af6f3890038b7ab
Author: ukai <ukai>
Date: Tue, 27 Nov 2001 18:29:24 +0000
[w3m-dev 02574] sysconfdir
From: Fumitoshi UKAI <ukai@debian.or.jp>
Diffstat:
6 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,16 @@
2001-11-28 Fumitoshi UKAI <ukai@debian.or.jp>
+ * [w3m-dev 02574] sysconfdir
+ * configure: add -bindir=* -libdir=* -helpdir=* -sysconfdir=*
+ * configure: add ETC_DIR
+ * indep.c (w3m_etc_dir): added
+ * indep.h: ditto
+ * rc.c (init_rc): use etcFile() instead of libFile()
+ * rc.c (etcFile): added
+ * proto.h: ditto
+
+2001-11-28 Fumitoshi UKAI <ukai@debian.or.jp>
+
* [w3m-dev 02578]
* file.c (process_anchor): support <input type="image">
* html.c (ALST_INPUT): add ATTR_SRC, ATTR_WIDTH, ATTR_HEIGHT
diff --git a/configure b/configure
@@ -55,6 +55,18 @@ do
-prefix=*|--prefix=*)
prefix=`expr "$1" : "-*prefix=\(.*\)"`
;;
+ -bindir=*|--bindir=*)
+ bindir=`expr "$1" : "-*bindir=\(.*\)"`
+ ;;
+ -libdir=*|--libdir=*)
+ libdir=`expr "$1" : "-*libdir=\(.*\)"`
+ ;;
+ -helpdir=*|--helpdir=*)
+ helpdir=`expr "$1" : "-*helpdir=\(.*\)"`
+ ;;
+ -sysconfdir=*|--sysconfdir=*)
+ sysconfdir=`expr "$1" : "-*sysconfdir=\(.*\)"`
+ ;;
-lang=en|--lang=en|-lang=EN|--lang=EN)
lang=EN
;;
@@ -104,6 +116,10 @@ do
-help|--help)
echo "-yes, -nonstop Set all parameters to the default"
echo "-prefix=DIR Specify prefix (default: /usr/local)"
+ echo "-bindir=DIR user executable in DIR (default: PREFIX/bin)"
+ echo "-libdir=DIR program executables in DIR (default: PREFIX/lib/w3m)"
+ echo "-helpdir=DIR help file in DIR (default: PREFIX/share/w3m)"
+ echo "-sysconfdir=DIR w3mconfig in DIR [PREFIX/etc/w3m]"
echo "-lang=(en|ja) Specify default language"
echo "-model=(baby|little|mouse|cookie|monster|custom)"
echo " Specify default model"
@@ -502,6 +518,16 @@ readdir "$d_helpdir"
helpdir=$_dir
echo "helpdir='$helpdir'" >> config.param
+d_sysconfdir=$sysconfdir
+if [ -z "$d_sysconfdir" ]; then
+ d_sysconfdir="$topdir/etc/w3m"
+fi
+echo "Which directory do you want to put the system wide w3m configuration file?"
+Echo "(default: $d_sysconfdir) "
+readdir "$d_sysconfdir"
+sysconfdir=$_dir
+echo "sysconfdir='$sysconfdir'" >> config.param
+
ask_choice "Which language do you prefer?" lang \
1 JA "Japanese (charset ISO-2022-JP, EUC-JP, Shift_JIS)" . \
2 EN "English (charset US_ASCII, ISO-8859-1, etc)" .
@@ -1889,6 +1915,7 @@ $def_matrix
BIN_DIR = $bindir
HELP_DIR = $helpdir
LIB_DIR = $libdir
+ETC_DIR = $sysconfdir
HELP_FILE = $helpfile
SYS_LIBRARIES = $gpmlib $extlib $termlib $ssllib $v6lib
LOCAL_LIBRARIES = $bsdlib $ldflags
@@ -1945,6 +1972,7 @@ $def_use_alarm
#define LIB_DIR "$libdir"
#define HELP_DIR "$helpdir"
+#define ETC_DIR "$sysconfdir"
#define HELP_FILE "w3mhelp.html"
#define W3MCONFIG "w3mconfig"
diff --git a/indep.c b/indep.c
@@ -696,6 +696,12 @@ w3m_lib_dir()
}
char *
+w3m_etc_dir()
+{
+ return w3m_dir("W3M_ETC_DIR", ETC_DIR);
+}
+
+char *
w3m_help_dir()
{
return w3m_dir("W3M_HELP_DIR", HELP_DIR);
diff --git a/indep.h b/indep.h
@@ -43,6 +43,7 @@ extern Str Str_form_unquote(Str x);
extern char *shell_quote(char *str);
extern char *w3m_lib_dir();
+extern char *w3m_etc_dir();
extern char *w3m_help_dir();
#define New(type) ((type*)GC_MALLOC(sizeof(type)))
diff --git a/proto.h b/proto.h
@@ -461,6 +461,7 @@ extern Buffer *load_option_panel(void);
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 *libFile(char *base);
extern char *helpFile(char *base);
extern void setLocalCookie(void);
diff --git a/rc.c b/rc.c
@@ -1196,7 +1196,7 @@ init_rc(char *config_file)
}
/* open config file */
- if ((f = fopen(libFile(W3MCONFIG), "rt")) != NULL) {
+ if ((f = fopen(etcFile(W3MCONFIG), "rt")) != NULL) {
interpret_rc(f);
fclose(f);
}
@@ -1371,6 +1371,15 @@ libFile(char *base)
}
char *
+etcFile(char *base)
+{
+ Str file = Strnew_charp(w3m_etc_dir());
+ Strcat_char(file, '/');
+ Strcat_charp(file, base);
+ return expandName(file->ptr);
+}
+
+char *
helpFile(char *base)
{
Str file = Strnew_charp(w3m_help_dir());