[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Print data of forms when halfdump option is set
halfdump オプションが指定された時に,<form> タグの情報についても出力す
るようにするためのパッチです.
このパッチを採用して頂けると,emacs-w3m で <form> タグを解析する必要が
なくなり非常に好都合なので,是非採用の検討をお願いします.
--- CVS/Base/main.c Wed Jan 23 22:24:06 2002
+++ main.c Wed Jan 23 23:38:15 2002
@@ -721,8 +721,6 @@
orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc);
err_msg = Strnew();
if (load_argc == 0) {
- if (w3m_halfdump)
- printf("<pre>\n");
/* no URL specified */
if (!isatty(0)) {
redin = newFileStream(fdopen(dup(0), "rb"), (void (*)())pclose);
@@ -784,8 +782,6 @@
if (i >= 0) {
SearchHeader = search_header;
DefaultType = default_type;
- if (w3m_halfdump)
- printf("<pre>\n");
if (w3m_dump == DUMP_HEAD) {
request = New(FormList);
request->method = FORM_METHOD_HEAD;
@@ -867,9 +863,6 @@
rFrame();
saveBuffer(Currentbuf, stdout);
}
- if (w3m_halfdump)
- printf("</pre><title>%s</title>\n",
- html_quote(newbuf->buffername));
}
else {
if (Currentbuf->frameset != NULL && RenderFrame)
--- CVS/Base/file.c Wed Jan 23 22:24:05 2002
+++ file.c Wed Jan 23 23:53:02 2002
@@ -4996,6 +4996,34 @@
}
}
+static void
+print_halfdump(char *title, TextLineList *buf)
+{
+ TextLineListItem *p;
+ FormList *fp;
+ int fid;
+
+ printf("<pre>");
+ for (p = buf->first; p; p = p->next)
+ printf("%s\n", p->ptr->line->ptr);
+ if (form_max >= 0) {
+ for (fid = 0; fid <= form_max; fid++) {
+ fp = forms[fid];
+ printf("<_form fid=\"%d\" action=\"%s\" method=\"%s\""
+ " target=\"%s\" charset=\"%s\" enctype=\"%s\""
+ " boundary=\"%s\">",
+ fid, fp->action->ptr,
+ (fp->method == FORM_METHOD_POST) ? "post"
+ : ((fp->method == FORM_METHOD_INTERNAL) ? "internal" : "get"),
+ fp->target ? fp->target : "NULL",
+ fp->charset ? code_to_str(fp->charset) : "NULL",
+ (fp->enctype == FORM_ENCTYPE_MULTIPART) ? "multipart/form-data" : "NULL",
+ fp->boundary ? html_quote(fp->boundary) : "NULL" );
+ }
+ }
+ printf("</pre><title>%s</title>\n", title ? html_quote(title) : "");
+}
+
void
loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal)
{
@@ -5038,12 +5066,7 @@
return;
}
- init_henv(&htmlenv1, &obuf, envs, MAX_ENV_LEVEL, NULL, newBuf->width, 0);
-
- if (w3m_halfdump)
- htmlenv1.f = stdout;
- else
- htmlenv1.buf = newTextLineList();
+ init_henv(&htmlenv1, &obuf, envs, MAX_ENV_LEVEL, newTextLineList(), newBuf->width, 0);
if (SETJMP(AbortLoading) != 0) {
HTMLlineproc1("<br>Transfer Interrupted!<br>", &htmlenv1);
@@ -5105,6 +5128,7 @@
term_raw();
signal(SIGINT, prevtrap);
}
+ print_halfdump(htmlenv1.title, htmlenv1.buf);
return;
}
phase2:
--
土屋 雅稔 ( TSUCHIYA Masatoshi )