[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>
This commit is contained in:
Fumitoshi UKAI
2002-06-01 17:09:04 +00:00
parent fc4b6e4a93
commit 900682ebd5
7 changed files with 88 additions and 14 deletions
+12 -1
View File
@@ -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''
@@ -3443,4 +3454,4 @@
* release-0-2-1
* import w3m-0.2.1
$Id: ChangeLog,v 1.381 2002/06/01 16:50:16 ukai Exp $
$Id: ChangeLog,v 1.382 2002/06/01 17:09:04 ukai Exp $
+2
View File
@@ -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
+2 -2
View File
@@ -1,4 +1,4 @@
# $Id: funcname.tab,v 1.9 2002/06/01 16:50:16 ukai Exp $
# $Id: funcname.tab,v 1.10 2002/06/01 17:09:05 ukai Exp $
# macro name function name
#----------------------------
@@@ nulcmd
@@ -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
+67 -2
View File
@@ -1,4 +1,4 @@
/* $Id: main.c,v 1.100 2002/06/01 16:50:16 ukai Exp $ */
/* $Id: main.c,v 1.101 2002/06/01 17:09:05 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -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
@@ -5092,6 +5093,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)
{
+2 -1
View File
@@ -1,4 +1,4 @@
/* $Id: proto.h,v 1.42 2002/06/01 16:50:16 ukai Exp $ */
/* $Id: proto.h,v 1.43 2002/06/01 17:09:05 ukai Exp $ */
/*
* This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended.
@@ -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);
+1 -6
View File
@@ -1,4 +1,4 @@
/* $Id: rc.c,v 1.44 2002/06/01 16:50:16 ukai Exp $ */
/* $Id: rc.c,v 1.45 2002/06/01 17:09:05 ukai Exp $ */
/*
* Initialization file etc.
*/
@@ -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) {
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: w3mhelperpanel.c,v 1.7 2001/12/02 16:26:08 ukai Exp $ */
/* $Id: w3mhelperpanel.c,v 1.8 2002/06/01 17:09:05 ukai Exp $ */
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
@@ -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