diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-12-27 17:50:56 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-12-27 17:50:56 +0000 |
commit | 119ef254bc6dc1f1364adfd7af59d7d7dcb1f006 (patch) | |
tree | 53c2052df3a6b15a4fd8fcb259af1a2c7dba353d | |
parent | [w3m-dev 02761] (diff) | |
download | w3m-119ef254bc6dc1f1364adfd7af59d7d7dcb1f006.tar.gz w3m-119ef254bc6dc1f1364adfd7af59d7d7dcb1f006.zip |
[w3m-dev 02765] backend
From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | backend.c | 23 | ||||
-rw-r--r-- | file.c | 17 | ||||
-rw-r--r-- | fm.h | 4 |
4 files changed, 34 insertions, 21 deletions
@@ -1,3 +1,12 @@ +2001-12-28 Hironori Sakamoto <h-saka@lsi.nec.co.jp> + + * [w3m-dev 02765] backend + * backend.c (internal_get): cleanups + * file.c (flushline): remove w3m_backend checks + * file.c (loadHTMLstream): add w3m_backend check + * fm.h (backend_halfdump_str): deleted + * fm.h (backend_halfdump_buf): added + 2001-12-28 Kiyokazu SUTO <suto@ks-and-ks.ne.jp> * [w3m-dev 02761] @@ -1723,4 +1732,4 @@ * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.191 2001/12/27 17:45:25 ukai Exp $ +$Id: ChangeLog,v 1.192 2001/12/27 17:50:56 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: backend.c,v 1.5 2001/11/24 02:01:26 ukai Exp $ */ +/* $Id: backend.c,v 1.6 2001/12/27 17:50:56 ukai Exp $ */ #include <stdio.h> #include <string.h> #include <sys/types.h> @@ -136,15 +136,21 @@ internal_get(char *url, int flag, FormList *request) { Buffer *buf; - backend_halfdump_str = Strnew_charp("<pre>\n"); + backend_halfdump_buf = NULL; do_download = flag; buf = loadGeneralFile(url, NULL, NO_REFERER, 0, request); do_download = FALSE; if (buf != NULL && buf != NO_BUFFER) { - if (!strcasecmp(buf->type, "text/html")) { - Strcat(backend_halfdump_str, - Sprintf("</pre><title>%s</title>\n", buf->buffername)); - print_headers(buf, backend_halfdump_str->length); + if (!strcasecmp(buf->type, "text/html") && backend_halfdump_buf) { + TextLineListItem *p; + Str first, last; + int len = 0; + for (p = backend_halfdump_buf->first; p; p = p->next) + len += p->ptr->line->length + 1; + first = Strnew_charp("<pre>\n"); + 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; @@ -154,7 +160,10 @@ internal_get(char *url, int flag, FormList *request) print_formlist(--fid, fp); } printf("\n"); - Strfputs(backend_halfdump_str, stdout); + printf("%s", first->ptr); + for (p = backend_halfdump_buf->first; p; p = p->next) + printf("%s\n", p->ptr->line->ptr); + printf("%s", last->ptr); } else { if (!strcasecmp(buf->type, "text/plain")) { @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.36 2001/12/27 17:45:26 ukai Exp $ */ +/* $Id: file.c,v 1.37 2001/12/27 17:50:56 ukai Exp $ */ #include "fm.h" #include <sys/types.h> #include "myctype.h" @@ -2025,13 +2025,8 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, #endif if (lbuf->pos > h_env->maxlimit) h_env->maxlimit = lbuf->pos; - if (buf) { + if (buf) pushTextLine(buf, lbuf); - if (w3m_backend) { - Strcat(backend_halfdump_str, lbuf->line); - Strcat_char(backend_halfdump_str, '\n'); - } - } else { Strfputs(lbuf->line, f); fputc('\n', f); @@ -2046,11 +2041,9 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, Str tmp = Strnew(), tmp2 = Strnew(); #define APPEND(str) \ - if (buf) { \ + if (buf) \ appendTextLine(buf,(str),0); \ - if (w3m_backend) \ - Strcat(backend_halfdump_str, (str)); \ - } else \ + else \ Strfputs((str),f) while (*p) { @@ -5074,6 +5067,8 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) newBuf->document_code = code; content_charset = '\0'; #endif /* JP_CHARSET */ + if (w3m_backend) + backend_halfdump_buf = htmlenv1.buf; HTMLlineproc2(newBuf, htmlenv1.buf); } @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.35 2001/12/27 17:37:49 ukai Exp $ */ +/* $Id: fm.h,v 1.36 2001/12/27 17:50:56 ukai Exp $ */ /* * w3m: WWW wo Miru utility * @@ -881,7 +881,7 @@ global int use_lessopen init(FALSE); global int FollowRedirection init(10); global int w3m_backend init(FALSE); -global Str backend_halfdump_str; +global TextLineList *backend_halfdump_buf; global TextList *backend_batch_commands init(NULL); int backend(void); extern void deleteFiles(void); |