w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit c73a83617e3546f1495191f2d61a26b94fa72901
parent c5ef940b6560f45e3f745865d3b190514b3b9508
Author: ukai <ukai>
Date:   Sat,  1 Jun 2002 17:09:04 +0000

[w3m-dev-en 00748] PATCH: Reinitialize w3m while running
* funcname.tab (INIT_MAILCAP): deleted
	(REINIT): added
* main.c (config_filename): added
	(reinit): added
* proto.h (reinit): added
* rc.c (rc_initialized): deleted
* w3mhelperpanel.c (editMailcap): use REINIT MAILCAP
From: Tushar Samant <scribble@pobox.com>

Diffstat:
MChangeLog | 11+++++++++++
MNEWS | 2++
Mfuncname.tab | 2+-
Mmain.c | 67++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Mproto.h | 1+
Mrc.c | 5-----
Mw3mhelperpanel.c | 2+-
7 files changed, 82 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,14 @@ +2002-06-02 Tushar Samant <scribble@pobox.com> + + * [w3m-dev-en 00748] PATCH: Reinitialize w3m while running + * funcname.tab (INIT_MAILCAP): deleted + (REINIT): added + * main.c (config_filename): added + (reinit): added + * proto.h (reinit): added + * rc.c (rc_initialized): deleted + * w3mhelperpanel.c (editMailcap): use REINIT MAILCAP + 2002-06-02 Kiyokazu SUTO <suto@ks-and-ks.ne.jp> * [w3m-dev 03200] Re: New configuration option ``keymap_file'' and new command ``DEFINE_KEY'' diff --git a/NEWS b/NEWS @@ -1,5 +1,7 @@ w3m 0.4? +* func: REINIT + INIT_MAILCAP deleted, use REINIT MAILCAP instead * func: DEFINE_KEY * rc: keymap_file * rc: use_dictcommand, dictcommand diff --git a/funcname.tab b/funcname.tab @@ -36,7 +36,6 @@ GOTO_RELATIVE gorURL HELP ldhelp HISTORY ldHist INFO pginfo -INIT_MAILCAP initMailcap INTERRUPT susp ISEARCH isrchfor ISEARCH_BACK isrchbak @@ -91,6 +90,7 @@ QUIT qquitfm READ_SHELL readsh REDRAW rdrwSc REG_MARK reMark +REINIT reinit RELOAD reload RIGHT col1R SAVE svSrc diff --git a/main.c b/main.c @@ -25,6 +25,8 @@ extern int do_getch(); #define DSTR_LEN 256 +static char *config_filename = NULL; + Hist *LoadHist; Hist *SaveHist; Hist *URLHist; @@ -354,7 +356,6 @@ MAIN(int argc, char **argv, char **envp) char search_header = FALSE; char *default_type = NULL; char *post_file = NULL; - char *config_filename = NULL; Str err_msg; #ifndef HAVE_SYS_ERRLIST @@ -5093,6 +5094,70 @@ setAlarmEvent(int sec, short status, int cmd, void *data) #endif void +reinit() +{ + char *resource = searchKeyData(); + + if (resource == NULL) { + init_rc(config_filename); +#ifdef USE_COOKIE + initCookie(); +#endif + initKeymap(); +#ifdef USE_MENU + initMenu(); +#endif + return; + } + + if (!strcasecmp(resource, "CONFIG") || !strcasecmp(resource, "RC")) { + init_rc(config_filename); + return; + } + +#ifdef USE_COOKIE + if (!strcasecmp(resource, "COOKIE")) { + initCookie(); + return; + } +#endif + + if (!strcasecmp(resource, "KEYMAP")) { + initKeymap(); + return; + } + + if (!strcasecmp(resource, "MAILCAP")) { + initMailcap(); + return; + } + +#ifdef USE_MENU + if (!strcasecmp(resource, "MENU")) { + initMenu(); + return; + } +#endif + + if (!strcasecmp(resource, "MIMETYPES")) { + initMimeTypes(); + return; + } + +#ifdef USE_EXTERNAL_URI_LOADER + if (!strcasecmp(resource, "URIMETHODS")) { + initURIMethods(); + return; + } +#endif + + disp_err_message( + Sprintf("Don't know how to reinitialize '%s'", resource)->ptr, + FALSE + ); +} + +void defKey(void) { char *data; diff --git a/proto.h b/proto.h @@ -116,6 +116,7 @@ extern void setAlarmEvent(int sec, short status, int cmd, void *data); #else #define setAlarm nulcmd #endif +extern void reinit(void); extern void defKey(void); extern int currentLn(Buffer *buf); extern void tmpClearBuffer(Buffer *buf); diff --git a/rc.c b/rc.c @@ -33,7 +33,6 @@ struct rc_search_table { static struct rc_search_table *RC_search_table; static int RC_table_size; -static int rc_initialized = 0; static char *config_file = NULL; #define P_INT 0 @@ -1259,10 +1258,6 @@ init_rc(char *config_filename) && ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0')) tmpdir = "/tmp"; - if (rc_initialized) - return; - rc_initialized = 1; - if (stat(rc_dir, &st) < 0) { if (errno == ENOENT) { /* no directory */ if (do_mkdir(rc_dir, 0700) < 0) { diff --git a/w3mhelperpanel.c b/w3mhelperpanel.c @@ -153,7 +153,7 @@ editMailcap(char *mailcap, struct parsed_tagarg *args) fclose(f); printf("Content-Type: text/plain\n"); printf("w3m-control: BACK\nw3m-control: BACK\n"); - printf("w3m-control: INIT_MAILCAP\n"); + printf("w3m-control: REINIT MAILCAP\n"); } int