aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-01-24 17:29:45 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-01-24 17:29:45 +0000
commitd7b44415da6ebe07bb1b5ebd7ce504d02bf66745 (patch)
treec7c3348457338c574e8af2f901b545d66d1d15bf
parent[w3m-dev 02901] DNS_ORDER_* (diff)
downloadw3m-d7b44415da6ebe07bb1b5ebd7ce504d02bf66745.tar.gz
w3m-d7b44415da6ebe07bb1b5ebd7ce504d02bf66745.zip
[w3m-dev 02901] Default URL for GOTO*
* fm.h (DEFAULT_URL_*): added * fm.h (DefaultURLString): added * main.c (cmd_loadURL): add arg "referer" * main.c (goURL0): 2nd arg is "relative" flag check DefaultURLString if relative, then current and referer is set * main.c (ldhelp): cmd_loadURL arg changes * main.c (deletePrevBuf): ditto * main.c (cmd_loadBuffer): ditto * main.c (adBmark): ditto * main.c (follow_map): ditto * rc.c (CMT_DEFAULT_URL): added * rc.c (defaulturls): added * rc.c (params9): add "default_url"
-rw-r--r--ChangeLog20
-rw-r--r--fm.h6
-rw-r--r--main.c53
-rw-r--r--rc.c19
4 files changed, 78 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 296895e..4914cbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2002-01-25 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 02901] Default URL for GOTO*
+ * fm.h (DEFAULT_URL_*): added
+ * fm.h (DefaultURLString): added
+ * main.c (cmd_loadURL): add arg `referer'
+ * main.c (goURL0): 2nd arg is `relative' flag
+ check DefaultURLString
+ if relative, then current and referer is set
+ * main.c (ldhelp): cmd_loadURL arg changes
+ * main.c (deletePrevBuf): ditto
+ * main.c (cmd_loadBuffer): ditto
+ * main.c (adBmark): ditto
+ * main.c (follow_map): ditto
+ * rc.c (CMT_DEFAULT_URL): added
+ * rc.c (defaulturls): added
+ * rc.c (params9): add "default_url"
+
+2002-01-25 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 02901] DNS_ORDER_*
* fm.h (DNS_ORDER_*): added
* rc.c (dnsorders): use N_S(DNS_ORDER_*)
@@ -2258,4 +2276,4 @@
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.257 2002/01/24 17:07:40 ukai Exp $
+$Id: ChangeLog,v 1.258 2002/01/24 17:29:45 ukai Exp $
diff --git a/fm.h b/fm.h
index 4d71f75..e3577d6 100644
--- a/fm.h
+++ b/fm.h
@@ -1,4 +1,4 @@
-/* $Id: fm.h,v 1.43 2002/01/24 17:07:40 ukai Exp $ */
+/* $Id: fm.h,v 1.44 2002/01/24 17:29:45 ukai Exp $ */
/*
* w3m: WWW wo Miru utility
*
@@ -775,6 +775,10 @@ global int UseExternalDirBuffer init(TRUE);
global char *DirBufferCommand init("file:///$LIB/dirlist" CGI_EXTENSION);
global int ignore_null_img_alt init(TRUE);
global int FoldTextarea init(FALSE);
+#define DEFAULT_URL_EMPTY 0
+#define DEFAULT_URL_CURRENT 1
+#define DEFAULT_URL_LINK 2
+global int DefaultURLString init(DEFAULT_URL_EMPTY);
#ifdef USE_MIGEMO
global int use_migemo init(FALSE);
diff --git a/main.c b/main.c
index 65e0756..8447fdd 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.70 2002/01/23 17:19:47 ukai Exp $ */
+/* $Id: main.c,v 1.71 2002/01/24 17:29:45 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -67,7 +67,7 @@ int (*searchRoutine) (Buffer *, char *);
JMP_BUF IntReturn;
static void cmd_loadfile(char *path);
-static void cmd_loadURL(char *url, ParsedURL *current);
+static void cmd_loadURL(char *url, ParsedURL *current, char *referer);
static void cmd_loadBuffer(Buffer *buf, int prop, int linkid);
static void keyPressEventProc(int c);
#ifdef USE_MARK
@@ -1833,9 +1833,9 @@ ldhelp(void)
"?version=%s&lang=%s",
Str_form_quote(Strnew_charp(w3m_version))->ptr,
Str_form_quote(Strnew_charp_n(lang, n))->ptr)->ptr,
- NULL);
+ NULL, NO_REFERER);
#else
- cmd_loadURL(helpFile(HELP_FILE), NULL);
+ cmd_loadURL(helpFile(HELP_FILE), NULL, NO_REFERER);
#endif
}
@@ -3573,7 +3573,7 @@ deletePrevBuf()
}
static void
-cmd_loadURL(char *url, ParsedURL *current)
+cmd_loadURL(char *url, ParsedURL *current, char *referer)
{
Buffer *buf;
@@ -3597,7 +3597,7 @@ cmd_loadURL(char *url, ParsedURL *current)
#endif /* USE_NNTP */
refresh();
- buf = loadGeneralFile(url, current, NO_REFERER, 0, NULL);
+ buf = loadGeneralFile(url, current, referer, 0, NULL);
if (buf == NULL) {
char *emsg = Sprintf("Can't load %s", conv_from_system(url))->ptr;
disp_err_message(emsg, FALSE);
@@ -3613,16 +3613,26 @@ cmd_loadURL(char *url, ParsedURL *current)
/* go to specified URL */
static void
-goURL0(char *prompt, ParsedURL *current)
+goURL0(char *prompt, int relative)
{
- char *url;
- ParsedURL p_url;
+ char *url, *referer;
+ ParsedURL p_url, *current;
Buffer *cur_buf = Currentbuf;
url = searchKeyData();
if (url == NULL) {
- if (current)
- url = parsedURL2Str(current)->ptr;
+ if (DefaultURLString == DEFAULT_URL_CURRENT) {
+ current = baseURL(Currentbuf);
+ if (current)
+ url = parsedURL2Str(current)->ptr;
+ }
+ else if (DefaultURLString == DEFAULT_URL_LINK) {
+ Anchor *a = retrieveCurrentAnchor(Currentbuf);
+ if (a) {
+ parseURL2(a->url, &p_url, baseURL(Currentbuf));
+ url = parsedURL2Str(&p_url)->ptr;
+ }
+ }
url = inputLineHist(prompt, url, IN_URL, URLHist);
if (url != NULL)
SKIP_BLANKS(url);
@@ -3643,9 +3653,17 @@ goURL0(char *prompt, ParsedURL *current)
gotoLabel(url + 1);
return;
}
+ if (relative) {
+ current = baseURL(Currentbuf);
+ referer = parsedURL2Str(&Currentbuf->currentURL)->ptr;
+ }
+ else {
+ current = NULL;
+ referer = NULL;
+ }
parseURL2(url, &p_url, current);
pushHashHist(URLHist, parsedURL2Str(&p_url)->ptr);
- cmd_loadURL(url, current);
+ cmd_loadURL(url, current, referer);
if (Currentbuf != cur_buf) /* success */
pushHashHist(URLHist, parsedURL2Str(&Currentbuf->currentURL)->ptr);
}
@@ -3653,13 +3671,13 @@ goURL0(char *prompt, ParsedURL *current)
void
goURL(void)
{
- goURL0("Goto URL: ", NULL);
+ goURL0("Goto URL: ", FALSE);
}
void
gorURL(void)
{
- goURL0("Goto relative URL: ", baseURL(Currentbuf));
+ goURL0("Goto relative URL: ", TRUE);
}
static void
@@ -3685,7 +3703,7 @@ cmd_loadBuffer(Buffer *buf, int prop, int linkid)
void
ldBmark(void)
{
- cmd_loadURL(BookmarkFile, NULL);
+ cmd_loadURL(BookmarkFile, NULL, NO_REFERER);
}
@@ -3702,7 +3720,7 @@ adBmark(void)
(Str_form_quote(parsedURL2Str(&Currentbuf->currentURL)))->
ptr,
(Str_form_quote(Strnew_charp(Currentbuf->buffername)))->ptr);
- cmd_loadURL(tmp->ptr, NULL);
+ cmd_loadURL(tmp->ptr, NULL, NO_REFERER);
}
/* option setting */
@@ -3788,7 +3806,8 @@ follow_map(struct parsed_tagarg *arg)
}
parseURL2(url, &p_url, baseURL(Currentbuf));
pushHashHist(URLHist, parsedURL2Str(&p_url)->ptr);
- cmd_loadURL(url, baseURL(Currentbuf));
+ cmd_loadURL(url, baseURL(Currentbuf),
+ parsedURL2Str(&Currentbuf->currentURL)->ptr);
#else
Buffer *buf;
diff --git a/rc.c b/rc.c
index 78a36eb..7c9db51 100644
--- a/rc.c
+++ b/rc.c
@@ -1,4 +1,4 @@
-/* $Id: rc.c,v 1.34 2002/01/24 17:07:40 ukai Exp $ */
+/* $Id: rc.c,v 1.35 2002/01/24 17:29:45 ukai Exp $ */
/*
* Initialization file etc.
*/
@@ -139,6 +139,7 @@ static char *config_file = NULL;
#define CMT_IGNORE_NULL_IMG_ALT "空のIMG ALT属性の時にリンク名を表示する"
#define CMT_IFILE "各ディレクトリのインデックスファイル"
#define CMT_RETRY_HTTP "URLに自動的に http:// を補う"
+#define CMT_DEFAULT_URL "URLを開く時のデフォルト文字列"
#define CMT_DECODE_CTE "保存時に Content-Transfer-Encoding をデコードする"
#ifdef USE_MOUSE
#define CMT_MOUSE "マウスを使う"
@@ -262,6 +263,7 @@ static char *config_file = NULL;
#define CMT_IGNORE_NULL_IMG_ALT "Ignore IMG ALT=\"\" (display link name)"
#define CMT_IFILE "Index file for the directory"
#define CMT_RETRY_HTTP "Prepend http:// to URL automatically"
+#define CMT_DEFAULT_URL "Default string when opening URL"
#define CMT_DECODE_CTE "Decode Content-Transfer-Encoding when saving"
#ifdef USE_MOUSE
#define CMT_MOUSE "Use mouse"
@@ -369,6 +371,18 @@ static char n_s[][2] = {
};
#define N_S(x) (x), n_s[(x)]
+static struct sel_c defaulturls[] = {
+#if LANG == JA
+ {N_S(DEFAULT_URL_EMPTY), "無し"},
+ {N_S(DEFAULT_URL_CURRENT), "現在のURL"},
+ {N_S(DEFAULT_URL_LINK), "リンク先のURL"},
+#else
+ {N_S(DEFAULT_URL_EMPTY), "empty"},
+ {N_S(DEFAULT_URL_CURRENT), "current URL"},
+ {N_S(DEFAULT_URL_LINK), "link URL"},
+#endif
+ {0, NULL, NULL}
+};
#ifdef INET6
static struct sel_c dnsorders[] = {
{N_S(DNS_ORDER_UNSPEC), "unspec"},
@@ -605,6 +619,9 @@ struct param_ptr params9[] = {
NULL},
{"retry_http", P_INT, PI_ONOFF, (void *)&retryAsHttp, CMT_RETRY_HTTP,
NULL},
+ {"default_url", P_INT, PI_SEL_C, (void *)&DefaultURLString,
+ CMT_DEFAULT_URL,
+ defaulturls},
{"follow_redirection", P_INT, PI_TEXT, &FollowRedirection,
CMT_FOLLOW_REDIRECTION, NULL},
{"meta_refresh", P_CHARINT, PI_ONOFF, (void *)&MetaRefresh,