aboutsummaryrefslogtreecommitdiffstats
path: root/map.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-02-05 16:43:56 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-02-05 16:43:56 +0000
commite312638d0c8d64fe85db128d0eb8c3885a8bfe88 (patch)
tree8ffc104ec0f6eef6aae2eea58ff34d882547d065 /map.c
parent[w3m-dev 03729] buf fix of reAnchorNewsheader() (diff)
downloadw3m-e312638d0c8d64fe85db128d0eb8c3885a8bfe88.tar.gz
w3m-e312638d0c8d64fe85db128d0eb8c3885a8bfe88.zip
[w3m-dev 03730] display decoded URL
* anchor.c (link_list_panel): support DecodeURL * display.c (make_lastline_link): support DecodeURL * etc.c (url_unquote_conv): added * fm.h (DecodeURL): added * history.c (historyBuffer): support DecodeURL * indep.c (QUOTE_MAP): added (HTML_QUOTE_MAP): added (html_quote_char): deleted (url_quote): use is_url_quote (file_quote): use is_file_quote (is_url_safe): deleted (Str_form_quote): use is_url_unsafe (Str_url_unquote): add safe args (is_shell_safe): delete (shell_quote): use is_shell_unsafe * indep.h (QUOTE_MAP): added (HTML_QUOTE_MAP): added (HTML_QUOTE_MASK): added (SHELL_UNSAFE_MASK): added (URL_QUOTE_MASK): added (FILE_QUOTE_MASK): added (URL_UNSAFE_MASK): added (GET_QUOTE_TYPE): added (is_html_quote): added (is_shell_unsafe): added (is_url_quote): added (is_file_quote): added (is_url_unsafe): added (html_quote_char): added (html_quote_char): deleted (Str_url_unquote): added safe (form_unquote): Str_url_unquote changes * linein.c (_prev): support DecodeURL (_next): ditto * main.c (goURL0): support DecodeURL (_peekURL): ditto (curURL): ditto * map.c (follow_map_panel): support DecodeURL (append_map_info): ditto (append_link_info): ditto (append_frame_info): ditto (page_info_panel): ditto * menu.c (initSelectMenu): delete SCM_LOCAL_CGI support DecodeURL (initSelTabMenu): delete SCM_LOCAL_CGI support DecodeURL (link_menu): support DecodeURL * parsetagx.c (parse_tag): is_html_quote * proto.h (url_unquote_conv): added * rc.c (CMT_DECODE_URL): added (params1): add decode_url * url.c (openURL): Str_url_unquote non safe From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r--map.c84
1 files changed, 58 insertions, 26 deletions
diff --git a/map.c b/map.c
index 7ce2cbe..c25cc92 100644
--- a/map.c
+++ b/map.c
@@ -1,4 +1,4 @@
-/* $Id: map.c,v 1.26 2003/01/20 15:54:11 ukai Exp $ */
+/* $Id: map.c,v 1.27 2003/02/05 16:43:59 ukai Exp $ */
/*
* client-side image maps
*/
@@ -263,7 +263,7 @@ follow_map_panel(Buffer *buf, char *name)
ListItem *al;
MapArea *a;
ParsedURL pu;
- char *url;
+ char *p, *q;
ml = searchMapList(buf, name);
if (ml == NULL)
@@ -275,10 +275,15 @@ follow_map_panel(Buffer *buf, char *name)
if (!a)
continue;
parseURL2(a->url, &pu, baseURL(buf));
- url = html_quote(parsedURL2Str(&pu)->ptr);
- Strcat_m_charp(mappage, "<tr valign=top><td><a href=\"", url, "\">",
+ p = parsedURL2Str(&pu)->ptr;
+ q = html_quote(p);
+ if (DecodeURL)
+ p = html_quote(url_unquote_conv(p, buf->document_code));
+ else
+ p = q;
+ Strcat_m_charp(mappage, "<tr valign=top><td><a href=\"", q, "\">",
html_quote(*a->alt ? a->alt : mybasename(a->url)),
- "</a><td>", url, NULL);
+ "</a><td>", p, NULL);
}
Strcat_charp(mappage, "</table></body></html>");
@@ -391,7 +396,7 @@ append_map_info(Buffer *buf, Str tmp, FormItemList *fi)
ListItem *al;
MapArea *a;
ParsedURL pu;
- char *url;
+ char *p, *q;
ml = searchMapList(buf, fi->value ? fi->value->ptr : NULL);
if (ml == NULL)
@@ -405,11 +410,15 @@ append_map_info(Buffer *buf, Str tmp, FormItemList *fi)
if (!a)
continue;
parseURL2(a->url, &pu, baseURL(buf));
- url = html_quote(parsedURL2Str(&pu)->ptr);
+ q = html_quote(parsedURL2Str(&pu)->ptr);
+ if (DecodeURL)
+ p = html_quote(url_unquote_conv(a->url, buf->document_code));
+ else
+ p = html_quote(a->url);
Strcat_m_charp(tmp, "<tr valign=top><td>&nbsp;&nbsp;<td><a href=\"",
- url, "\">",
+ q, "\">",
html_quote(*a->alt ? a->alt : mybasename(a->url)),
- "</a><td>", html_quote(a->url), "\n", NULL);
+ "</a><td>", p, "\n", NULL);
}
Strcat_charp(tmp, "</table>");
}
@@ -440,8 +449,13 @@ append_link_info(Buffer *buf, Str html, LinkList * link)
Strcat_charp(html, "[Rel]");
else if (l->type == LINK_TYPE_REV)
Strcat_charp(html, "[Rev]");
- Strcat_m_charp(html, "<td>", l->url ? html_quote(l->url) : "(empty)",
- NULL);
+ if (!l->url)
+ url = "(empty)";
+ else if (DecodeURL)
+ url = html_quote(url_unquote_conv(l->url, buf->document_code));
+ else
+ url = html_quote(l->url);
+ Strcat_m_charp(html, "<td>", url, NULL);
if (l->ctype)
Strcat_m_charp(html, " (", html_quote(l->ctype), ")", NULL);
Strcat_charp(html, "\n");
@@ -473,14 +487,16 @@ append_frame_info(Buffer *buf, Str html, struct frameset *set, int level)
q = html_quote(frame.body->url);
Strcat_m_charp(html, "<a href=\"", q, "\">", NULL);
if (frame.body->name) {
- p = file_unquote(frame.body->name);
-#ifdef JP_CHARSET
- p = conv(p, buf->document_code, InnerCode)->ptr;
-#endif
- p = html_quote(p);
+ p = html_quote(url_unquote_conv(frame.body->name,
+ buf->document_code));
Strcat_charp(html, p);
}
- Strcat_m_charp(html, " ", q, "</a></pre_int><br>\n", NULL);
+ if (DecodeURL)
+ p = html_quote(url_unquote_conv(frame.body->url,
+ buf->document_code));
+ else
+ p = q;
+ Strcat_m_charp(html, " ", p, "</a></pre_int><br>\n", NULL);
#ifdef USE_SSL
if (frame.body->ssl_certificate)
Strcat_m_charp(html,
@@ -505,11 +521,11 @@ page_info_panel(Buffer *buf)
{
Str tmp = Strnew_size(1024);
Anchor *a;
- Str s;
ParsedURL pu;
TextListItem *ti;
struct frameset *f_set = NULL;
int all;
+ char *p, *q;
Strcat_charp(tmp, "<html><head>\
<title>Information about current page</title>\
@@ -520,11 +536,14 @@ page_info_panel(Buffer *buf)
all = buf->allLine;
if (all == 0 && buf->lastLine)
all = buf->lastLine->linenumber;
+ p = parsedURL2Str(&buf->currentURL)->ptr;
+ if (DecodeURL)
+ p = url_unquote_conv(p, 0);
Strcat_m_charp(tmp, "<table cellpadding=0>",
"<tr valign=top><td nowrap>Title<td>",
html_quote(buf->buffername),
"<tr valign=top><td nowrap>Current URL<td>",
- html_quote(parsedURL2Str(&buf->currentURL)->ptr),
+ html_quote(p),
"<tr valign=top><td nowrap>Document Type<td>",
buf->real_type ? html_quote(buf->real_type) : "unknown",
"<tr valign=top><td nowrap>Last Modified<td>",
@@ -540,29 +559,42 @@ page_info_panel(Buffer *buf)
a = retrieveCurrentAnchor(buf);
if (a != NULL) {
- char *aurl;
parseURL2(a->url, &pu, baseURL(buf));
- s = parsedURL2Str(&pu);
- aurl = html_quote(s->ptr);
+ p = parsedURL2Str(&pu)->ptr;
+ q = html_quote(p);
+ if (DecodeURL)
+ p = html_quote(url_unquote_conv(p, buf->document_code));
+ else
+ p = q;
Strcat_m_charp(tmp,
"<tr valign=top><td nowrap>URL of current anchor<td><a href=\"",
- aurl, "\">", aurl, "</a>", NULL);
+ q, "\">", p, "</a>", NULL);
}
a = retrieveCurrentImg(buf);
if (a != NULL) {
parseURL2(a->url, &pu, baseURL(buf));
- s = parsedURL2Str(&pu);
+ p = parsedURL2Str(&pu)->ptr;
+ q = html_quote(p);
+ if (DecodeURL)
+ p = html_quote(url_unquote_conv(p, buf->document_code));
+ else
+ p = q;
Strcat_m_charp(tmp,
"<tr valign=top><td nowrap>URL of current image<td><a href=\"",
- html_quote(s->ptr), "\">", html_quote(s->ptr), "</a>",
+ q, "\">", p, "</a>",
NULL);
}
a = retrieveCurrentForm(buf);
if (a != NULL) {
FormItemList *fi = (FormItemList *)a->url;
+ p = form2str(fi);
+ if (DecodeURL)
+ p = html_quote(url_unquote_conv(p, buf->document_code));
+ else
+ p = html_quote(p);
Strcat_m_charp(tmp,
"<tr valign=top><td nowrap>Method/type of current form&nbsp;<td>",
- html_quote(form2str(fi)), NULL);
+ p, NULL);
if (fi->parent->method == FORM_METHOD_INTERNAL
&& !Strcmp_charp(fi->parent->action, "map"))
append_map_info(buf, tmp, fi->parent->item);