From f4d6305bdddca9c1deb51bd19904779cbbf4406b Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Fri, 10 Jan 2003 17:06:17 +0000 Subject: [w3m-dev 03632] cleanup (don't close connection of news server) * file.c (loadSomething): remove UFclose nntp:,news: (loadFile): UFclose (loadGeneralFile): always UFclose * html.h (UFclose): only reset when ISclose ==0 * istream.c (ISclose): return int (ISfileno): flag IST_UNCLOSE * istream.h (ISclose): return int (IST_UNCLOSE): added * news.c (news_close): reset IST_UNCLOSE (news_open): set IST_UNCLOSE From: Hironori SAKAMOTO --- istream.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'istream.c') diff --git a/istream.c b/istream.c index 7777bc2..b5e8c8d 100644 --- a/istream.c +++ b/istream.c @@ -1,4 +1,4 @@ -/* $Id: istream.c,v 1.17 2003/01/10 16:58:31 ukai Exp $ */ +/* $Id: istream.c,v 1.18 2003/01/10 17:06:23 ukai Exp $ */ #include "fm.h" #include "myctype.h" #include "istream.h" @@ -176,15 +176,17 @@ newEncodedStream(InputStream is, char encoding) return stream; } -void +int ISclose(InputStream stream) { MySignalHandler(*prevtrap) (); - if (stream == NULL || stream->base.close == NULL) - return; + if (stream == NULL || stream->base.close == NULL || + stream->base.type & IST_UNCLOSE) + return -1; prevtrap = signal(SIGINT, SIG_IGN); stream->base.close(stream->base.handle); signal(SIGINT, prevtrap); + return 0; } int @@ -336,7 +338,7 @@ ISfileno(InputStream stream) { if (stream == NULL) return -1; - switch (IStype(stream)) { + switch (IStype(stream) & ~IST_UNCLOSE) { case IST_BASIC: return *(int *)stream->base.handle; case IST_FILE: -- cgit v1.2.3