diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-02-03 06:12:41 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-02-03 06:12:41 +0000 |
commit | 63dffdd551989100dc3ad845b1f5a2126a59be6e (patch) | |
tree | 2208cf1f19c74ad407ccc98e61f04579e58e75c0 /file.c | |
parent | [w3m-dev 02972] (diff) | |
download | w3m-63dffdd551989100dc3ad845b1f5a2126a59be6e.tar.gz w3m-63dffdd551989100dc3ad845b1f5a2126a59be6e.zip |
[w3m-dev 02964] Print data of forms when halfdump option is set
* backend.c (print_headers): print w3m-current-url and w3m-base-url
* backend.c (print_formlist): deleted
* backend.c (internal_get): remove "if (buf->formlist) {}"
* file.c (print_internal_information): added
* file.c (loadHTMLstream): if halfdump, print_internal_information
if w3m_backend, print_internal_information
* fm.h (DUMP_HALFEXTRA): added
* main.c (-halfdump_extra): added
From: TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp>
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 71 |
1 files changed, 68 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.58 2002/02/01 05:01:47 ukai Exp $ */ +/* $Id: file.c,v 1.59 2002/02/03 06:12:41 ukai Exp $ */ #include "fm.h" #include <sys/types.h> #include "myctype.h" @@ -5714,6 +5714,66 @@ completeHTMLstream(struct html_feed_environ *h_env, struct readbuffer *obuf) } } +static void +print_internal_information(struct html_feed_environ *henv) +{ + int i; + Str s; + TextLineList *tl = newTextLineList(); + + if (form_max >= 0) { + FormList *fp; + for (i = 0; i <= form_max; i++) { + fp = forms[i]; + s = Sprintf("<form_int fid=\"%d\" action=\"%s\" method=\"%s\"", + i, fp->action->ptr, + (fp->method == FORM_METHOD_POST) ? "post" + : ((fp->method == FORM_METHOD_INTERNAL) ? "internal" : "get")); + if (fp->target) + Strcat(s, Sprintf(" target=\"%s\"", fp->target)); + if (fp->charset) + Strcat(s, Sprintf(" accept-charset=\"%s\"", code_to_str(fp->charset))); + if (fp->enctype == FORM_ENCTYPE_MULTIPART) + Strcat_charp(s, " enctype=multipart/form-data"); + if (fp->boundary) + Strcat_m_charp(s, " boundary=\"", html_quote(fp->boundary), "\"", NULL); + Strcat_charp(s, ">"); + pushTextLine(tl, newTextLine(s, 0)); + } + } +#ifdef MENU_SELECT + if (n_select > 0) { + FormSelectOptionItem *ip; + for (i = 0; i < n_select; i++) { + for (ip = select_option[i].first; ip; ip = ip->next) { + s = Sprintf("<option_int selectnumber=%d" + " value=\"%s\"%s>%s</option_int>", + i, + html_quote(ip->value ? ip->value->ptr : ip->label->ptr), + ip->checked ? " selected" : "", + ip->label->ptr); + pushTextLine(tl, newTextLine(s, 0)); + } + } + } +#endif /* MENU_SELECT */ + if (n_textarea > 0) { + for (i = 0; i < n_textarea; i++) { + s = Sprintf("<textarea_int textareanumber=%d>%s</textarea_int>", + i, textarea_str[i]->ptr); + pushTextLine(tl, newTextLine(s, 0)); + } + } + + if (henv->buf) + appendTextLineList(henv->buf, tl); + else if (henv->f) { + TextLineListItem *p; + for (p = tl->first; p; p = p->next) + printf("%s\n", p->ptr->line->ptr); + } +} + void loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) { @@ -5850,6 +5910,13 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) if (fmInitialized) term_raw(); signal(SIGINT, prevtrap); + if (w3m_dump & DUMP_HALFEXTRA) + print_internal_information(&htmlenv1); + return; + } + if (w3m_backend) { + print_internal_information(&htmlenv1); + backend_halfdump_buf = htmlenv1.buf; return; } phase2: @@ -5864,8 +5931,6 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) #ifdef USE_IMAGE newBuf->image_flag = image_flag; #endif - if (w3m_backend) - backend_halfdump_buf = htmlenv1.buf; HTMLlineproc2(newBuf, htmlenv1.buf); } |