commit 2f1bdadb44fd55013fcfef77aff00571c2e16dfa
parent b8c78e82fb5b067b122c11653a772cc9381eb065
Author: ukai <ukai>
Date: Fri, 24 Jan 2003 17:36:44 +0000
[w3m-dev 03683] interrupt in getNextPage()
* file.c (getNextPage): trap SIGINT
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,10 @@
2003-01-25 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03683] interrupt in getNextPage()
+ * file.c (getNextPage): trap SIGINT
+
+2003-01-25 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03682] open null file on tab
* display.c (displayBuffer): if empty, clear()
diff --git a/file.c b/file.c
@@ -7192,24 +7192,25 @@ openGeneralPagerBuffer(InputStream stream)
Line *
getNextPage(Buffer *buf, int plen)
{
- Line *top = buf->topLine, *last = buf->lastLine, *cur = buf->currentLine;
- int i, nlines = 0;
+ Line *volatile top = buf->topLine, *volatile last = buf->lastLine,
+ *volatile cur = buf->currentLine;
+ int i;
+ int volatile nlines = 0;
clen_t linelen = 0, trbyte = buf->trbyte;
Str lineBuf2;
- char pre_lbuf = '\0';
+ char volatile pre_lbuf = '\0';
URLFile uf;
- char code;
- int squeeze_flag = FALSE;
+ char volatile code;
+ int volatile squeeze_flag = FALSE;
Lineprop *propBuffer = NULL;
#ifdef USE_ANSI_COLOR
Linecolor *colorBuffer = NULL;
#endif
+ MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL;
if (buf->pagerSource == NULL)
return NULL;
- if (fmInitialized)
- crmode();
if (last != NULL) {
nlines = last->real_linenumber;
pre_lbuf = *(last->lineBuf);
@@ -7224,6 +7225,14 @@ getNextPage(Buffer *buf, int plen)
else
code = DocumentCode;
#endif
+
+ if (SETJMP(AbortLoading) != 0) {
+ goto pager_end;
+ }
+ prevtrap = signal(SIGINT, KeyAbort);
+ if (fmInitialized)
+ term_cbreak();
+
init_stream(&uf, SCM_UNKNOWN, NULL);
for (i = 0; i < plen; i++) {
lineBuf2 = StrmyISgets(buf->pagerSource);
@@ -7284,8 +7293,11 @@ getNextPage(Buffer *buf, int plen)
buf->firstLine->prev = NULL;
}
}
+ pager_end:
if (fmInitialized)
term_raw();
+ signal(SIGINT, prevtrap);
+
buf->trbyte = trbyte + linelen;
#ifdef JP_CHARSET
buf->document_code = code;