aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-01-10 16:08:19 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-01-10 16:08:19 +0000
commit900d16573c6efcdca06925ca66f9fe9ef5a845ec (patch)
tree024475070996701b912eab600528e8cc63a43754
parent[w3m-dev 03619] Re: Error occured while reset (diff)
downloadw3m-900d16573c6efcdca06925ca66f9fe9ef5a845ec.tar.gz
w3m-900d16573c6efcdca06925ca66f9fe9ef5a845ec.zip
[w3m-dev 03620] -m option and header
* buffer.c (reshapeBuffer): fix reading from stdin fix -m option * display.c (redrawNLine): rewrite (redrawLine): return l instead of l->next (redrawLineImage): ditto * file.c (loadFile): read header even if skip header (loadGeneralFile): read header even if skip header * fm.h (SkipHeader): added * main.c (main): check whether reading from stdin SkipHeader From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r--ChangeLog16
-rw-r--r--buffer.c12
-rw-r--r--display.c34
-rw-r--r--file.c12
-rw-r--r--fm.h3
-rw-r--r--main.c11
6 files changed, 53 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index fa59cb9..e489a86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2003-01-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
+ * [w3m-dev 03620] -m option and header
+ * buffer.c (reshapeBuffer): fix reading from stdin
+ fix -m option
+ * display.c (redrawNLine): rewrite
+ (redrawLine): return l instead of l->next
+ (redrawLineImage): ditto
+ * file.c (loadFile): read header even if skip header
+ (loadGeneralFile): read header even if skip header
+ * fm.h (SkipHeader): added
+ * main.c (main): check whether reading from stdin
+ SkipHeader
+
2003-01-10 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03619] Re: Error occured while reset
@@ -6244,4 +6258,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.661 2003/01/09 15:30:20 ukai Exp $
+$Id: ChangeLog,v 1.662 2003/01/10 16:08:19 ukai Exp $
diff --git a/buffer.c b/buffer.c
index 48cc361..effd57b 100644
--- a/buffer.c
+++ b/buffer.c
@@ -1,4 +1,4 @@
-/* $Id: buffer.c,v 1.16 2002/12/02 17:27:36 ukai Exp $ */
+/* $Id: buffer.c,v 1.17 2003/01/10 16:08:20 ukai Exp $ */
#include "fm.h"
#ifdef USE_MOUSE
@@ -530,9 +530,9 @@ reshapeBuffer(Buffer *buf)
UseContentCharset = FALSE;
UseAutoDetect = FALSE;
#endif
- if (buf->search_header && buf->currentURL.scheme == SCM_LOCAL) {
- if (buf->header_source && (buf->mailcap_source ||
- !strcmp(buf->currentURL.file, "-"))) {
+ if (buf->header_source) {
+ if (buf->currentURL.scheme != SCM_LOCAL ||
+ buf->mailcap_source || !strcmp(buf->currentURL.file, "-")) {
URLFile h;
init_stream(&h, SCM_LOCAL, NULL);
examineFile(buf->header_source, &h);
@@ -540,8 +540,8 @@ reshapeBuffer(Buffer *buf)
readHeader(&h, buf, TRUE, NULL);
UFclose(&h);
}
- }
- else
+ }
+ else if (buf->search_header) /* -m option */
readHeader(&f, buf, TRUE, NULL);
}
diff --git a/display.c b/display.c
index f37b9e5..0bde4e5 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.49 2002/12/27 16:46:13 ukai Exp $ */
+/* $Id: display.c,v 1.50 2003/01/10 16:08:20 ukai Exp $ */
#include <signal.h>
#include "fm.h"
@@ -561,7 +561,7 @@ drawAnchorCursor(Buffer *buf)
static void
redrawNLine(Buffer *buf, int n)
{
- Line *l, *l0;
+ Line *l;
int i;
#ifdef USE_COLOR
@@ -616,19 +616,13 @@ redrawNLine(Buffer *buf, int n)
for (i = 0; i < COLS; i++)
addch('~');
}
- for (i = 0, l = buf->topLine; i < buf->LINES; i++) {
+ for (i = 0, l = buf->topLine; i < buf->LINES; i++, l = l->next) {
if (i >= buf->LINES - n || i < -n)
- l0 = redrawLine(buf, l, i + buf->rootY);
- else {
- l0 = (l) ? l->next : NULL;
- }
- if (l0 == NULL && l == NULL)
+ l = redrawLine(buf, l, i + buf->rootY);
+ if (l == NULL)
break;
- l = l0;
}
if (n > 0) {
- if (i == 0 && buf->topLine != NULL)
- i++;
move(i + buf->rootY, 0);
clrtobotx();
}
@@ -637,15 +631,9 @@ redrawNLine(Buffer *buf, int n)
if (!(activeImage && displayImage && buf->img))
return;
move(buf->cursorY + buf->rootY, buf->cursorX + buf->rootX);
- for (i = 0, l = buf->topLine; i < buf->LINES; i++) {
+ for (i = 0, l = buf->topLine; i < buf->LINES && l; i++, l = l->next) {
if (i >= buf->LINES - n || i < -n)
- l0 = redrawLineImage(buf, l, i + buf->rootY);
- else {
- l0 = (l) ? l->next : NULL;
- }
- if (l0 == NULL && l == NULL)
- break;
- l = l0;
+ redrawLineImage(buf, l, i + buf->rootY);
}
getAllImage(buf);
#endif
@@ -702,7 +690,7 @@ redrawLine(Buffer *buf, Line *l, int i)
l->width = COLPOS(l, l->len);
if (l->len == 0 || l->width - 1 < column) {
clrtoeolx();
- return l->next;
+ return l;
}
/* need_clrtoeol(); */
pos = columnPos(l, column);
@@ -818,7 +806,7 @@ redrawLine(Buffer *buf, Line *l, int i)
#endif
if (rcol - column < buf->COLS)
clrtoeolx();
- return l->next;
+ return l;
}
#ifdef USE_IMAGE
@@ -835,7 +823,7 @@ redrawLineImage(Buffer *buf, Line *l, int i)
if (l->width < 0)
l->width = COLPOS(l, l->len);
if (l->len == 0 || l->width - 1 < column)
- return l->next;
+ return l;
pos = columnPos(l, column);
rcol = COLPOS(l, pos);
for (j = 0; rcol - column < buf->COLS && pos + j < l->len; j++) {
@@ -888,7 +876,7 @@ redrawLineImage(Buffer *buf, Line *l, int i)
}
rcol = COLPOS(l, pos + j + 1);
}
- return l->next;
+ return l;
}
#endif
diff --git a/file.c b/file.c
index 6f8fb58..b57b016 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.178 2003/01/09 15:30:34 ukai Exp $ */
+/* $Id: file.c,v 1.179 2003/01/10 16:08:21 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -472,16 +472,20 @@ convertLine(URLFile *uf, Str line, char *code, int mode)
Buffer *
loadFile(char *path)
{
+ Buffer *buf;
URLFile uf;
init_stream(&uf, SCM_LOCAL, NULL);
examineFile(path, &uf);
if (uf.stream == NULL)
return NULL;
+ buf = newBuffer(INIT_BUFFER_WIDTH);
+ if (SkipHeader)
+ readHeader(&uf, buf, TRUE, NULL);
current_content_length = 0;
#ifdef JP_CHARSET
content_charset = '\0';
#endif
- return loadSomething(&uf, path, loadBuffer, NULL);
+ return loadSomething(&uf, path, loadBuffer, buf);
}
int
@@ -1907,6 +1911,10 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
if (f.guess_type)
t = f.guess_type;
}
+ if (SkipHeader) {
+ t_buf = newBuffer(INIT_BUFFER_WIDTH);
+ readHeader(&f, t_buf, TRUE, NULL);
+ }
if (real_type == NULL)
real_type = t;
proc = loadBuffer;
diff --git a/fm.h b/fm.h
index e647b96..a67926f 100644
--- a/fm.h
+++ b/fm.h
@@ -1,4 +1,4 @@
-/* $Id: fm.h,v 1.100 2002/12/27 16:07:44 ukai Exp $ */
+/* $Id: fm.h,v 1.101 2003/01/10 16:08:22 ukai Exp $ */
/*
* w3m: WWW wo Miru utility
*
@@ -765,6 +765,7 @@ global char InnerCode init(CODE_INNER_EUC); /* use EUC-JP internally; do not cha
#endif /* JP_CHARSET */
global char SearchHeader init(FALSE);
+global char SkipHeader init(FALSE);
global char *DefaultType init(NULL);
global char RenderFrame init(FALSE);
global char TargetSelf init(FALSE);
diff --git a/main.c b/main.c
index af395b7..b1224d9 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.186 2003/01/09 15:30:48 ukai Exp $ */
+/* $Id: main.c,v 1.187 2003/01/10 16:08:23 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -886,7 +886,8 @@ main(int argc, char **argv, char **envp)
}
else if (newbuf == NO_BUFFER)
continue;
- newbuf->search_header = search_header;
+ if (newbuf->pagerSource || strcmp(newbuf->currentURL.file, "-"))
+ newbuf->search_header = search_header;
if (CurrentTab == NULL) {
FirstTab = LastTab = CurrentTab = newTab();
nTab = 1;
@@ -4409,12 +4410,15 @@ vwSrc(void)
char old_code = DocumentCode;
DocumentCode = Currentbuf->document_code;
#endif
+ SkipHeader = Currentbuf->search_header;
buf = loadFile(fn);
#ifdef JP_CHARSET
DocumentCode = old_code;
#endif
+ SkipHeader = FALSE;
if (buf == NULL)
return;
+ buf->search_header = Currentbuf->search_header;
buf->type = "text/plain";
if (Currentbuf->real_type &&
!strcasecmp(Currentbuf->real_type, "text/html"))
@@ -4427,11 +4431,14 @@ vwSrc(void)
Currentbuf->linkBuffer[LB_SOURCE] = buf;
}
else if (!strcasecmp(Currentbuf->type, "text/plain")) {
+ SkipHeader = Currentbuf->search_header;
DefaultType = "text/html";
buf = loadGeneralFile(file_to_url(fn), NULL, NO_REFERER, 0, NULL);
+ SkipHeader = FALSE;
DefaultType = NULL;
if (buf == NULL || buf == NO_BUFFER)
return;
+ buf->search_header = Currentbuf->search_header;
if (Currentbuf->real_type &&
!strcasecmp(Currentbuf->real_type, "text/plain"))
buf->real_type = "text/html";