[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>
This commit is contained in:
@@ -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>
|
2003-01-10 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
|
||||||
|
|
||||||
* [w3m-dev 03619] Re: Error occured while reset
|
* [w3m-dev 03619] Re: Error occured while reset
|
||||||
@@ -6244,4 +6258,4 @@ a * [w3m-dev 03276] compile error on EWS4800
|
|||||||
* release-0-2-1
|
* release-0-2-1
|
||||||
* import w3m-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 $
|
||||||
|
|||||||
@@ -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"
|
#include "fm.h"
|
||||||
|
|
||||||
#ifdef USE_MOUSE
|
#ifdef USE_MOUSE
|
||||||
@@ -530,9 +530,9 @@ reshapeBuffer(Buffer *buf)
|
|||||||
UseContentCharset = FALSE;
|
UseContentCharset = FALSE;
|
||||||
UseAutoDetect = FALSE;
|
UseAutoDetect = FALSE;
|
||||||
#endif
|
#endif
|
||||||
if (buf->search_header && buf->currentURL.scheme == SCM_LOCAL) {
|
if (buf->header_source) {
|
||||||
if (buf->header_source && (buf->mailcap_source ||
|
if (buf->currentURL.scheme != SCM_LOCAL ||
|
||||||
!strcmp(buf->currentURL.file, "-"))) {
|
buf->mailcap_source || !strcmp(buf->currentURL.file, "-")) {
|
||||||
URLFile h;
|
URLFile h;
|
||||||
init_stream(&h, SCM_LOCAL, NULL);
|
init_stream(&h, SCM_LOCAL, NULL);
|
||||||
examineFile(buf->header_source, &h);
|
examineFile(buf->header_source, &h);
|
||||||
@@ -541,7 +541,7 @@ reshapeBuffer(Buffer *buf)
|
|||||||
UFclose(&h);
|
UFclose(&h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (buf->search_header) /* -m option */
|
||||||
readHeader(&f, buf, TRUE, NULL);
|
readHeader(&f, buf, TRUE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 <signal.h>
|
||||||
#include "fm.h"
|
#include "fm.h"
|
||||||
|
|
||||||
@@ -561,7 +561,7 @@ drawAnchorCursor(Buffer *buf)
|
|||||||
static void
|
static void
|
||||||
redrawNLine(Buffer *buf, int n)
|
redrawNLine(Buffer *buf, int n)
|
||||||
{
|
{
|
||||||
Line *l, *l0;
|
Line *l;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#ifdef USE_COLOR
|
#ifdef USE_COLOR
|
||||||
@@ -616,19 +616,13 @@ redrawNLine(Buffer *buf, int n)
|
|||||||
for (i = 0; i < COLS; i++)
|
for (i = 0; i < COLS; i++)
|
||||||
addch('~');
|
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)
|
if (i >= buf->LINES - n || i < -n)
|
||||||
l0 = redrawLine(buf, l, i + buf->rootY);
|
l = redrawLine(buf, l, i + buf->rootY);
|
||||||
else {
|
if (l == NULL)
|
||||||
l0 = (l) ? l->next : NULL;
|
|
||||||
}
|
|
||||||
if (l0 == NULL && l == NULL)
|
|
||||||
break;
|
break;
|
||||||
l = l0;
|
|
||||||
}
|
}
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
if (i == 0 && buf->topLine != NULL)
|
|
||||||
i++;
|
|
||||||
move(i + buf->rootY, 0);
|
move(i + buf->rootY, 0);
|
||||||
clrtobotx();
|
clrtobotx();
|
||||||
}
|
}
|
||||||
@@ -637,15 +631,9 @@ redrawNLine(Buffer *buf, int n)
|
|||||||
if (!(activeImage && displayImage && buf->img))
|
if (!(activeImage && displayImage && buf->img))
|
||||||
return;
|
return;
|
||||||
move(buf->cursorY + buf->rootY, buf->cursorX + buf->rootX);
|
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)
|
if (i >= buf->LINES - n || i < -n)
|
||||||
l0 = redrawLineImage(buf, l, i + buf->rootY);
|
redrawLineImage(buf, l, i + buf->rootY);
|
||||||
else {
|
|
||||||
l0 = (l) ? l->next : NULL;
|
|
||||||
}
|
|
||||||
if (l0 == NULL && l == NULL)
|
|
||||||
break;
|
|
||||||
l = l0;
|
|
||||||
}
|
}
|
||||||
getAllImage(buf);
|
getAllImage(buf);
|
||||||
#endif
|
#endif
|
||||||
@@ -702,7 +690,7 @@ redrawLine(Buffer *buf, Line *l, int i)
|
|||||||
l->width = COLPOS(l, l->len);
|
l->width = COLPOS(l, l->len);
|
||||||
if (l->len == 0 || l->width - 1 < column) {
|
if (l->len == 0 || l->width - 1 < column) {
|
||||||
clrtoeolx();
|
clrtoeolx();
|
||||||
return l->next;
|
return l;
|
||||||
}
|
}
|
||||||
/* need_clrtoeol(); */
|
/* need_clrtoeol(); */
|
||||||
pos = columnPos(l, column);
|
pos = columnPos(l, column);
|
||||||
@@ -818,7 +806,7 @@ redrawLine(Buffer *buf, Line *l, int i)
|
|||||||
#endif
|
#endif
|
||||||
if (rcol - column < buf->COLS)
|
if (rcol - column < buf->COLS)
|
||||||
clrtoeolx();
|
clrtoeolx();
|
||||||
return l->next;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_IMAGE
|
#ifdef USE_IMAGE
|
||||||
@@ -835,7 +823,7 @@ redrawLineImage(Buffer *buf, Line *l, int i)
|
|||||||
if (l->width < 0)
|
if (l->width < 0)
|
||||||
l->width = COLPOS(l, l->len);
|
l->width = COLPOS(l, l->len);
|
||||||
if (l->len == 0 || l->width - 1 < column)
|
if (l->len == 0 || l->width - 1 < column)
|
||||||
return l->next;
|
return l;
|
||||||
pos = columnPos(l, column);
|
pos = columnPos(l, column);
|
||||||
rcol = COLPOS(l, pos);
|
rcol = COLPOS(l, pos);
|
||||||
for (j = 0; rcol - column < buf->COLS && pos + j < l->len; j++) {
|
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);
|
rcol = COLPOS(l, pos + j + 1);
|
||||||
}
|
}
|
||||||
return l->next;
|
return l;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -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 "fm.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "myctype.h"
|
#include "myctype.h"
|
||||||
@@ -472,16 +472,20 @@ convertLine(URLFile *uf, Str line, char *code, int mode)
|
|||||||
Buffer *
|
Buffer *
|
||||||
loadFile(char *path)
|
loadFile(char *path)
|
||||||
{
|
{
|
||||||
|
Buffer *buf;
|
||||||
URLFile uf;
|
URLFile uf;
|
||||||
init_stream(&uf, SCM_LOCAL, NULL);
|
init_stream(&uf, SCM_LOCAL, NULL);
|
||||||
examineFile(path, &uf);
|
examineFile(path, &uf);
|
||||||
if (uf.stream == NULL)
|
if (uf.stream == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
buf = newBuffer(INIT_BUFFER_WIDTH);
|
||||||
|
if (SkipHeader)
|
||||||
|
readHeader(&uf, buf, TRUE, NULL);
|
||||||
current_content_length = 0;
|
current_content_length = 0;
|
||||||
#ifdef JP_CHARSET
|
#ifdef JP_CHARSET
|
||||||
content_charset = '\0';
|
content_charset = '\0';
|
||||||
#endif
|
#endif
|
||||||
return loadSomething(&uf, path, loadBuffer, NULL);
|
return loadSomething(&uf, path, loadBuffer, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -1907,6 +1911,10 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
|
|||||||
if (f.guess_type)
|
if (f.guess_type)
|
||||||
t = 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)
|
if (real_type == NULL)
|
||||||
real_type = t;
|
real_type = t;
|
||||||
proc = loadBuffer;
|
proc = loadBuffer;
|
||||||
|
|||||||
@@ -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
|
* 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 */
|
#endif /* JP_CHARSET */
|
||||||
|
|
||||||
global char SearchHeader init(FALSE);
|
global char SearchHeader init(FALSE);
|
||||||
|
global char SkipHeader init(FALSE);
|
||||||
global char *DefaultType init(NULL);
|
global char *DefaultType init(NULL);
|
||||||
global char RenderFrame init(FALSE);
|
global char RenderFrame init(FALSE);
|
||||||
global char TargetSelf init(FALSE);
|
global char TargetSelf init(FALSE);
|
||||||
|
|||||||
@@ -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
|
#define MAINPROGRAM
|
||||||
#include "fm.h"
|
#include "fm.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -886,7 +886,8 @@ main(int argc, char **argv, char **envp)
|
|||||||
}
|
}
|
||||||
else if (newbuf == NO_BUFFER)
|
else if (newbuf == NO_BUFFER)
|
||||||
continue;
|
continue;
|
||||||
newbuf->search_header = search_header;
|
if (newbuf->pagerSource || strcmp(newbuf->currentURL.file, "-"))
|
||||||
|
newbuf->search_header = search_header;
|
||||||
if (CurrentTab == NULL) {
|
if (CurrentTab == NULL) {
|
||||||
FirstTab = LastTab = CurrentTab = newTab();
|
FirstTab = LastTab = CurrentTab = newTab();
|
||||||
nTab = 1;
|
nTab = 1;
|
||||||
@@ -4409,12 +4410,15 @@ vwSrc(void)
|
|||||||
char old_code = DocumentCode;
|
char old_code = DocumentCode;
|
||||||
DocumentCode = Currentbuf->document_code;
|
DocumentCode = Currentbuf->document_code;
|
||||||
#endif
|
#endif
|
||||||
|
SkipHeader = Currentbuf->search_header;
|
||||||
buf = loadFile(fn);
|
buf = loadFile(fn);
|
||||||
#ifdef JP_CHARSET
|
#ifdef JP_CHARSET
|
||||||
DocumentCode = old_code;
|
DocumentCode = old_code;
|
||||||
#endif
|
#endif
|
||||||
|
SkipHeader = FALSE;
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return;
|
return;
|
||||||
|
buf->search_header = Currentbuf->search_header;
|
||||||
buf->type = "text/plain";
|
buf->type = "text/plain";
|
||||||
if (Currentbuf->real_type &&
|
if (Currentbuf->real_type &&
|
||||||
!strcasecmp(Currentbuf->real_type, "text/html"))
|
!strcasecmp(Currentbuf->real_type, "text/html"))
|
||||||
@@ -4427,11 +4431,14 @@ vwSrc(void)
|
|||||||
Currentbuf->linkBuffer[LB_SOURCE] = buf;
|
Currentbuf->linkBuffer[LB_SOURCE] = buf;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(Currentbuf->type, "text/plain")) {
|
else if (!strcasecmp(Currentbuf->type, "text/plain")) {
|
||||||
|
SkipHeader = Currentbuf->search_header;
|
||||||
DefaultType = "text/html";
|
DefaultType = "text/html";
|
||||||
buf = loadGeneralFile(file_to_url(fn), NULL, NO_REFERER, 0, NULL);
|
buf = loadGeneralFile(file_to_url(fn), NULL, NO_REFERER, 0, NULL);
|
||||||
|
SkipHeader = FALSE;
|
||||||
DefaultType = NULL;
|
DefaultType = NULL;
|
||||||
if (buf == NULL || buf == NO_BUFFER)
|
if (buf == NULL || buf == NO_BUFFER)
|
||||||
return;
|
return;
|
||||||
|
buf->search_header = Currentbuf->search_header;
|
||||||
if (Currentbuf->real_type &&
|
if (Currentbuf->real_type &&
|
||||||
!strcasecmp(Currentbuf->real_type, "text/plain"))
|
!strcasecmp(Currentbuf->real_type, "text/plain"))
|
||||||
buf->real_type = "text/html";
|
buf->real_type = "text/html";
|
||||||
|
|||||||
Reference in New Issue
Block a user