From c5ec364d23f9db99f51f51ca62565cfb1392d268 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Fri, 10 Jan 2003 16:58:30 +0000 Subject: [w3m-dev 03631] display current form item * form.c (form2str): rewrite * istream.c (ssl_get_certificate): fix typo * map.c (follow_map_panel): valign=top (append_map_info): valign=top (append_link_info): valign=top (append_frame_info): html_quote ssl_certificate (page_info_panel): rewrite, html_quote From: Hironori SAKAMOTO --- ChangeLog | 14 +++++++- form.c | 29 ++++++++------- istream.c | 4 +-- map.c | 122 ++++++++++++++++++++++++++++---------------------------------- 4 files changed, 86 insertions(+), 83 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e7e115..92dcf40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2003-01-11 Hironori SAKAMOTO + + * [w3m-dev 03631] display current form item + * form.c (form2str): rewrite + * istream.c (ssl_get_certificate): fix typo + * map.c (follow_map_panel): valign=top + (append_map_info): valign=top + (append_link_info): valign=top + (append_frame_info): + html_quote ssl_certificate + (page_info_panel): rewrite, html_quote + 2003-01-11 Fumitoshi UKAI * doc/README.pre_form: update @@ -6323,4 +6335,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.669 2003/01/10 16:51:08 ukai Exp $ +$Id: ChangeLog,v 1.670 2003/01/10 16:58:30 ukai Exp $ diff --git a/form.c b/form.c index 5fce3e8..2096661 100644 --- a/form.c +++ b/form.c @@ -1,4 +1,4 @@ -/* $Id: form.c,v 1.26 2003/01/10 16:48:49 ukai Exp $ */ +/* $Id: form.c,v 1.27 2003/01/10 16:58:31 ukai Exp $ */ /* * HTML forms */ @@ -160,8 +160,8 @@ formList_addInput(struct form_list *fl, struct parsed_tag *tag) } static char *_formtypetbl[] = { - "text", "password", "checkbox", "radio", "submit", - "reset", "hidden", "image", "select", "textarea", "button", "file", 0, + "text", "password", "checkbox", "radio", "submit", "reset", "hidden", + "image", "select", "textarea", "button", "file", NULL }; static char *_formmethodtbl[] = { @@ -171,16 +171,19 @@ static char *_formmethodtbl[] = { char * form2str(FormItemList *fi) { - Str tmp; - if (fi->type == FORM_INPUT_SUBMIT || - fi->type == FORM_INPUT_IMAGE || fi->type == FORM_INPUT_BUTTON) { - tmp = Strnew_charp(_formmethodtbl[fi->parent->method]); - Strcat_char(tmp, ' '); - Strcat(tmp, fi->parent->action); - return tmp->ptr; - } - else - return _formtypetbl[fi->type]; + Str tmp = Strnew(); + + if (fi->type != FORM_SELECT && fi->type != FORM_TEXTAREA) + Strcat_charp(tmp, "input type="); + Strcat_charp(tmp, _formtypetbl[fi->type]); + if (fi->name && fi->name->length) + Strcat_m_charp(tmp, " name=\"", fi->name->ptr, "\"", NULL); + if ((fi->type == FORM_INPUT_RADIO || fi->type == FORM_INPUT_CHECKBOX || + fi->type == FORM_SELECT) && fi->value) + Strcat_m_charp(tmp, " value=\"", fi->value->ptr, "\"", NULL); + Strcat_m_charp(tmp, " (", _formmethodtbl[fi->parent->method], " ", + fi->parent->action->ptr, ")", NULL); + return tmp->ptr; } int diff --git a/istream.c b/istream.c index fafb3b8..7777bc2 100644 --- a/istream.c +++ b/istream.c @@ -1,4 +1,4 @@ -/* $Id: istream.c,v 1.16 2002/12/24 17:20:47 ukai Exp $ */ +/* $Id: istream.c,v 1.17 2003/01/10 16:58:31 ukai Exp $ */ #include "fm.h" #include "myctype.h" #include "istream.h" @@ -578,7 +578,7 @@ ssl_get_certificate(SSL * ssl, char *hostname) Strcat_m_charp(s, " subject=", buf, NULL); xn = X509_get_issuer_name(x); if (X509_NAME_get_text_by_NID(xn, NID_commonName, buf, sizeof(buf)) == -1) - Strcat_charp(s, ": issuer="); + Strcat_charp(s, ": issuer="); else Strcat_m_charp(s, ": issuer=", buf, NULL); Strcat_charp(s, "\n\n"); diff --git a/map.c b/map.c index 9d9f603..941f2a7 100644 --- a/map.c +++ b/map.c @@ -1,4 +1,4 @@ -/* $Id: map.c,v 1.22 2002/12/13 02:19:01 ukai Exp $ */ +/* $Id: map.c,v 1.23 2003/01/10 16:58:31 ukai Exp $ */ /* * client-side image maps */ @@ -271,7 +271,7 @@ follow_map_panel(Buffer *buf, char *name) continue; parseURL2(a->url, &pu, baseURL(buf)); url = html_quote(parsedURL2Str(&pu)->ptr); - Strcat_m_charp(mappage, "", + Strcat_m_charp(mappage, "", html_quote(*a->alt ? a->alt : mybasename(a->url)), "", url, NULL); } @@ -392,15 +392,17 @@ append_map_info(Buffer *buf, Str tmp, FormItemList *fi) if (ml == NULL) return; - Strcat_charp(tmp, "Links of current image map"); - Strcat_charp(tmp, ""); + Strcat_m_charp(tmp, + "
Links of current image map", + "
", NULL); for (al = ml->area->first; al != NULL; al = al->next) { a = (MapArea *) al->ptr; if (!a) continue; parseURL2(a->url, &pu, baseURL(buf)); url = html_quote(parsedURL2Str(&pu)->ptr); - Strcat_m_charp(tmp, "
  ", + Strcat_m_charp(tmp, "
  ", html_quote(*a->alt ? a->alt : mybasename(a->url)), "", html_quote(a->url), "\n", NULL); } @@ -418,8 +420,7 @@ append_link_info(Buffer *buf, Str html, LinkList * link) if (!link) return; - Strcat_charp(html, "

Link information

"); - Strcat_charp(html, "\n"); + Strcat_charp(html, "

Link information

\n"); for (l = link; l; l = l->next) { if (l->url) { parseURL2(l->url, &pu, baseURL(buf)); @@ -427,20 +428,20 @@ append_link_info(Buffer *buf, Str html, LinkList * link) } else url = "(empty)"; - Strcat_m_charp(html, "
", - l->title ? html_quote(l->title) : "(empty)", "", + Strcat_m_charp(html, "
", + l->title ? html_quote(l->title) : "(empty)", "", NULL); if (l->type == LINK_TYPE_REL) Strcat_charp(html, "[Rel]"); else if (l->type == LINK_TYPE_REV) Strcat_charp(html, "[Rev]"); - Strcat_m_charp(html, "", l->url ? html_quote(l->url) : "(empty)", + Strcat_m_charp(html, "", l->url ? html_quote(l->url) : "(empty)", NULL); if (l->ctype) Strcat_m_charp(html, " (", html_quote(l->ctype), ")", NULL); Strcat_charp(html, "\n"); } - Strcat_charp(html, "
\n"); + Strcat_charp(html, "
\n"); } /* append frame URL */ @@ -461,12 +462,11 @@ append_frame_info(Buffer *buf, Str html, struct frameset *set, int level) case F_BODY: if (frame.body->url == NULL) break; + Strcat_charp(html, ""); for (j = 0; j < level; j++) Strcat_charp(html, " "); q = html_quote(frame.body->url); - Strcat_charp(html, ""); + Strcat_m_charp(html, "", NULL); if (frame.body->name) { p = file_unquote(frame.body->name); #ifdef JP_CHARSET @@ -475,13 +475,11 @@ append_frame_info(Buffer *buf, Str html, struct frameset *set, int level) p = html_quote(p); Strcat_charp(html, p); } - Strcat_charp(html, " "); - Strcat_charp(html, q); - Strcat_charp(html, "\n"); + Strcat_m_charp(html, " ", q, "
\n", NULL); #ifdef USE_SSL if (frame.body->ssl_certificate) - Strcat_m_charp(html, "
\n",
-				   frame.body->ssl_certificate,
+		    Strcat_m_charp(html, "

SSL certificate

\n",
+				   html_quote(frame.body->ssl_certificate),
 				   "
\n", NULL); #endif break; @@ -507,34 +505,33 @@ page_info_panel(Buffer *buf) struct frameset *f_set = NULL; int all; - Strcat_charp(tmp, - "Information about current page"); - Strcat_charp(tmp, - "

Information about current page

"); + Strcat_charp(tmp, "\ +Information about current page\ +\ +

Information about current page

\n"); if (buf == NULL) goto end; - Strcat_charp(tmp, "
Title"); - Strcat_charp(tmp, html_quote(buf->buffername)); - Strcat_charp(tmp, "
Current URL"); - Strcat_charp(tmp, html_quote(parsedURL2Str(&buf->currentURL)->ptr)); - Strcat_charp(tmp, "
Document Type"); - if (buf->real_type) - Strcat_charp(tmp, buf->real_type); - else - Strcat_charp(tmp, "unknown"); - Strcat_charp(tmp, "
Last Modified"); - Strcat_charp(tmp, html_quote(last_modified(buf))); -#ifdef JP_CHARSET - Strcat_charp(tmp, "
Document Code"); - Strcat_charp(tmp, code_to_str(buf->document_code)); -#endif /* JP_CHARSET */ - Strcat_charp(tmp, "
Number of lines"); all = buf->allLine; if (all == 0 && buf->lastLine) all = buf->lastLine->linenumber; - Strcat(tmp, Sprintf("%d", all)); - Strcat_charp(tmp, "
Transferred bytes"); - Strcat(tmp, Sprintf("%d", buf->trbyte)); + Strcat_m_charp(tmp, "", + "
Title", + html_quote(buf->buffername), + "
Current URL", + html_quote(parsedURL2Str(&buf->currentURL)->ptr), + "
Document Type", + buf->real_type ? html_quote(buf->real_type) : "unknown", + "
Last Modified", + html_quote(last_modified(buf)), +#ifdef JP_CHARSET + "
Document Code", + code_to_str(buf->document_code), +#endif /* JP_CHARSET */ + "
Number of lines", + Sprintf("%d", all)->ptr, + "
Transferred bytes", + Sprintf("%d", buf->trbyte)->ptr, + NULL); a = retrieveCurrentAnchor(buf); if (a != NULL) { @@ -542,26 +539,22 @@ page_info_panel(Buffer *buf) parseURL2(a->url, &pu, baseURL(buf)); s = parsedURL2Str(&pu); aurl = html_quote(s->ptr); - Strcat_charp(tmp, "
URL of current anchor"); - Strcat_m_charp(tmp, "", aurl, "", NULL); + Strcat_m_charp(tmp, "
URL of current anchor", aurl, "", NULL); } a = retrieveCurrentImg(buf); if (a != NULL) { parseURL2(a->url, &pu, baseURL(buf)); s = parsedURL2Str(&pu); - Strcat_charp(tmp, "
URL of current image"); - Strcat_charp(tmp, "ptr)); - Strcat_charp(tmp, "\">"); - Strcat_charp(tmp, html_quote(s->ptr)); - Strcat_charp(tmp, ""); + Strcat_m_charp(tmp, "
URL of current imageptr), "\">", html_quote(s->ptr), + "", NULL); } a = retrieveCurrentForm(buf); if (a != NULL) { FormItemList *fi = (FormItemList *)a->url; - s = Strnew_charp(form2str(fi)); - Strcat_charp(tmp, "
Method/type of current form"); - Strcat_charp(tmp, html_quote(s->ptr)); + Strcat_m_charp(tmp, "
Method/type of current form ", + html_quote(form2str(fi)), NULL); if (fi->parent->method == FORM_METHOD_INTERNAL && !Strcmp_charp(fi->parent->action, "map")) append_map_info(buf, tmp, fi->parent->item); @@ -571,12 +564,11 @@ page_info_panel(Buffer *buf) append_link_info(buf, tmp, buf->linklist); if (buf->document_header != NULL) { - Strcat_charp(tmp, "
\n"); - Strcat_charp(tmp, "

Header information

\n"); - for (ti = buf->document_header->first; ti != NULL; ti = ti->next) { - Strcat_charp(tmp, html_quote(ti->ptr)); - Strcat_charp(tmp, "
"); - } + Strcat_charp(tmp, "

Header information

\n");
+	for (ti = buf->document_header->first; ti != NULL; ti = ti->next)
+	    Strcat_m_charp(tmp, "", html_quote(ti->ptr),
+			   "\n", NULL);
+	Strcat_charp(tmp, "
\n"); } if (buf->frameset != NULL) @@ -586,17 +578,13 @@ page_info_panel(Buffer *buf) f_set = buf->nextBuffer->frameset; if (f_set) { - Strcat_charp(tmp, "

Frame information

");
+	Strcat_charp(tmp, "

Frame information

\n"); append_frame_info(buf, tmp, f_set, 0); - Strcat_charp(tmp, "
"); } #ifdef USE_SSL - if (buf->ssl_certificate == NULL) - goto end; - Strcat_charp(tmp, "

SSL certificate

\n"); - Strcat_charp(tmp, "
\n");
-    Strcat_charp(tmp, buf->ssl_certificate);
-    Strcat_charp(tmp, "
\n"); + if (buf->ssl_certificate) + Strcat_m_charp(tmp, "

SSL certificate

\n",
+		       html_quote(buf->ssl_certificate), "
\n", NULL); #endif end: Strcat_charp(tmp, ""); -- cgit v1.2.3