aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-01-22 15:56:49 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-01-22 15:56:49 +0000
commit9241f55eee8c74450dde9c6799372f881469679f (patch)
tree924e43640da5feaf0bc95242c8fcfaf1f8c60c89 /main.c
parent[w3m-dev 03671] Re: config.param is clear when configure -help (diff)
downloadw3m-9241f55eee8c74450dde9c6799372f881469679f.tar.gz
w3m-9241f55eee8c74450dde9c6799372f881469679f.zip
[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 (limited to 'main.c')
-rw-r--r--main.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/main.c b/main.c
index 428d2ae..094cb0c 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.195 2003/01/17 17:06:04 ukai Exp $ */
+/* $Id: main.c,v 1.196 2003/01/22 15:56:50 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -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 */