aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog14
-rw-r--r--backend.c36
-rw-r--r--file.c71
-rw-r--r--fm.h3
-rw-r--r--main.c4
5 files changed, 90 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index 020698c..525ece5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2002-02-03 TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp>
+
+ * [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
+
2002-02-01 Dai Sato <satodai@dog.intcul.tohoku.ac.jp>
* [w3m-dev 02972] #include "config.h"
@@ -2709,4 +2721,4 @@
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.291 2002/02/01 14:06:46 inu Exp $
+$Id: ChangeLog,v 1.292 2002/02/03 06:12:41 ukai Exp $
diff --git a/backend.c b/backend.c
index 3d63d1f..8ce0c07 100644
--- a/backend.c
+++ b/backend.c
@@ -1,4 +1,4 @@
-/* $Id: backend.c,v 1.7 2001/12/27 18:22:59 ukai Exp $ */
+/* $Id: backend.c,v 1.8 2002/02/03 06:12:41 ukai Exp $ */
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
@@ -97,6 +97,9 @@ print_headers(Buffer *buf, int len)
for (tp = buf->document_header->first; tp; tp = tp->next)
printf("%s\n", tp->ptr);
}
+ printf("w3m-current-url: %s\n", parsedURL2Str(&buf->currentURL)->ptr);
+ if (buf->baseURL)
+ printf("w3m-base-url: %s\n", parsedURL2Str(buf->baseURL)->ptr);
printf("w3m-content-type: %s\n", buf->type);
#ifdef JP_CHARSET
if (buf->document_code)
@@ -109,29 +112,6 @@ print_headers(Buffer *buf, int len)
static void
-print_formlist(int fid, FormList *fp)
-{
- Str s =
- Sprintf("w3m-form: (formlist (fid %d) (action \"%s\") (method \"%s\")",
- fid,
- 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(" (charset '%s)", get_mime_charset_name(fp->charset)));
- if (fp->enctype == FORM_ENCTYPE_MULTIPART)
- Strcat_charp(s, " (enctype \"multipart/form-data\")");
- if (fp->boundary)
- Strcat(s, Sprintf(" (boundary \"%s\")", fp->boundary));
- Strcat_charp(s, ")\n");
- Strfputs(s, stdout);
-}
-
-
-static void
internal_get(char *url, int flag, FormList *request)
{
Buffer *buf;
@@ -151,14 +131,6 @@ internal_get(char *url, int flag, FormList *request)
last = Strnew_m_charp("</pre><title>", html_quote(buf->buffername),
"</title>\n", NULL);
print_headers(buf, len + first->length + last->length);
- if (buf->formlist) {
- FormList *fp;
- int fid = 0;
- for (fp = buf->formlist; fp; fp = fp->next)
- fid++;
- for (fp = buf->formlist; fp; fp = fp->next)
- print_formlist(--fid, fp);
- }
printf("\n");
printf("%s", first->ptr);
for (p = backend_halfdump_buf->first; p; p = p->next)
diff --git a/file.c b/file.c
index eae0724..48b9b8f 100644
--- a/file.c
+++ b/file.c
@@ -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);
}
diff --git a/fm.h b/fm.h
index 8675d93..554e04c 100644
--- a/fm.h
+++ b/fm.h
@@ -1,4 +1,4 @@
-/* $Id: fm.h,v 1.46 2002/01/31 17:54:51 ukai Exp $ */
+/* $Id: fm.h,v 1.47 2002/02/03 06:12:41 ukai Exp $ */
/*
* w3m: WWW wo Miru utility
*
@@ -772,6 +772,7 @@ extern char *w3m_version;
#define DUMP_EXTRA 0x08
#define DUMP_HALFDUMP 0x10
#define DUMP_FRAME 0x20
+#define DUMP_HALFEXTRA 0x40
global int w3m_debug;
global int w3m_dump init(0);
#define w3m_halfdump (w3m_dump & DUMP_HALFDUMP)
diff --git a/main.c b/main.c
index ae9f8eb..97452ef 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.77 2002/01/31 17:54:52 ukai Exp $ */
+/* $Id: main.c,v 1.78 2002/02/03 06:12:41 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -562,6 +562,8 @@ MAIN(int argc, char **argv, char **envp)
w3m_dump = (DUMP_HEAD | DUMP_SOURCE | DUMP_EXTRA);
else if (!strcmp("-halfdump", argv[i]))
w3m_dump = DUMP_HALFDUMP;
+ else if (!strcmp("-halfdump_extra", argv[i]))
+ w3m_dump = DUMP_HALFDUMP | DUMP_HALFEXTRA;
else if (!strcmp("-halfload", argv[i])) {
w3m_dump = 0;
w3m_halfload = TRUE;