w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit e76ef922a341a95cadbc0792827e9bfd9dd9844d
parent f2ab09676686ceb7638c1997ef664557ec731764
Author: ukai <ukai>
Date:   Wed, 22 Jan 2003 15:56:49 +0000

[w3m-dev 03674] -dump problem
* file.c (loadGeneralFile): return NULL when dump
* main.c (dump_source): deleted
	(dump_head): deleted
	(dupm_extra): deleted
	(do_dump): added
	(main): singal when dump
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>

Diffstat:
MChangeLog | 10++++++++++
Mfile.c | 2++
Mmain.c | 46+++++++++++++++++++++++++++++-----------------
3 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,13 @@ +2003-01-23 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 03674] -dump problem + * file.c (loadGeneralFile): return NULL when dump + * main.c (dump_source): deleted + (dump_head): deleted + (dupm_extra): deleted + (do_dump): added + (main): singal when dump + 2003-01-23 Yoshinobu Sakane <sakane@d4.bsd.nes.nec.co.jp> * [w3m-dev 03671] Re: config.param is clear when configure -help diff --git a/file.c b/file.c @@ -2062,6 +2062,8 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, return NO_BUFFER; } } + else if (w3m_dump & DUMP_FRAME) + return NULL; if (flag & RG_FRAME) { if (t_buf == NULL) diff --git a/main.c b/main.c @@ -80,9 +80,7 @@ static char *getCurWord(Buffer *buf, int *spos, int *epos, const char *badchars); static int display_ok = FALSE; -static void dump_source(Buffer *); -static void dump_head(Buffer *); -static void dump_extra(Buffer *); +static void do_dump(Buffer *); int prec_num = 0; int prev_key = -1; int on_target = 1; @@ -752,6 +750,8 @@ main(int argc, char **argv, char **envp) if (w3m_backend) backend(); + if (w3m_dump) + signal(SIGINT, SIG_IGN); #ifdef SIGCHLD signal(SIGCHLD, sig_chld); #endif @@ -900,22 +900,13 @@ main(int argc, char **argv, char **envp) Currentbuf->nextBuffer = newbuf; Currentbuf = newbuf; } - if (w3m_dump) { - if (w3m_dump & DUMP_EXTRA) - dump_extra(Currentbuf); - if (w3m_dump & DUMP_HEAD) - dump_head(Currentbuf); - if (w3m_dump & DUMP_SOURCE) - dump_source(Currentbuf); - if (w3m_dump == DUMP_BUFFER) { - if (Currentbuf->frameset != NULL && RenderFrame) - rFrame(); - saveBuffer(Currentbuf, stdout); - } - } - else { + if (!w3m_dump || w3m_dump == DUMP_BUFFER) { if (Currentbuf->frameset != NULL && RenderFrame) rFrame(); + } + if (w3m_dump) + do_dump(Currentbuf); + else { Currentbuf = newbuf; #ifdef USE_BUFINFO saveBufferInfo(); @@ -1167,6 +1158,27 @@ dump_extra(Buffer *buf) #endif } +static void +do_dump(Buffer *buf) +{ + MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL; + + prevtrap = signal(SIGINT, intTrap); + if (SETJMP(IntReturn) != 0) { + signal(SIGINT, prevtrap); + return; + } + if (w3m_dump & DUMP_EXTRA) + dump_extra(buf); + if (w3m_dump & DUMP_HEAD) + dump_head(buf); + if (w3m_dump & DUMP_SOURCE) + dump_source(buf); + if (w3m_dump == DUMP_BUFFER) + saveBuffer(buf, stdout); + signal(SIGINT, prevtrap); +} + void nulcmd(void) { /* do nothing */