aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-01-10 17:06:17 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-01-10 17:06:17 +0000
commitf4d6305bdddca9c1deb51bd19904779cbbf4406b (patch)
tree06f30cd3d18ec1357802f1b836a83007992c3267
parentfix indent (diff)
downloadw3m-f4d6305bdddca9c1deb51bd19904779cbbf4406b.tar.gz
w3m-f4d6305bdddca9c1deb51bd19904779cbbf4406b.zip
[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 <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r--ChangeLog16
-rw-r--r--file.c18
-rw-r--r--html.h4
-rw-r--r--istream.c12
-rw-r--r--istream.h5
-rw-r--r--news.c4
6 files changed, 38 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 92dcf40..56b61bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2003-01-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [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
+
+2003-01-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03631] display current form item
* form.c (form2str): rewrite
* istream.c (ssl_get_certificate): fix typo
@@ -6335,4 +6349,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.670 2003/01/10 16:58:30 ukai Exp $
+$Id: ChangeLog,v 1.671 2003/01/10 17:06:17 ukai Exp $
diff --git a/file.c b/file.c
index f849487..240aae5 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.182 2003/01/10 16:42:29 ukai Exp $ */
+/* $Id: file.c,v 1.183 2003/01/10 17:06:20 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -225,8 +225,6 @@ loadSomething(URLFile *f,
buf->real_scheme = f->scheme;
if (f->scheme == SCM_LOCAL && buf->sourcefile == NULL)
buf->sourcefile = path;
- if (f->scheme != SCM_NNTP && f->scheme != SCM_NEWS)
- UFclose(f);
return buf;
}
@@ -485,7 +483,9 @@ loadFile(char *path)
#ifdef JP_CHARSET
content_charset = '\0';
#endif
- return loadSomething(&uf, path, loadBuffer, buf);
+ buf = loadSomething(&uf, path, loadBuffer, buf);
+ UFclose(&uf);
+ return buf;
}
int
@@ -1942,7 +1942,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
doFileSave(f, file);
if (f.scheme == SCM_FTP)
FTPhalfclose(f.stream);
- else if (f.scheme != SCM_NNTP && f.scheme != SCM_NEWS)
+ else
UFclose(&f);
return NO_BUFFER;
}
@@ -2004,8 +2004,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
if (b->currentURL.host == NULL && b->currentURL.file == NULL)
copyParsedURL(&b->currentURL, &pu);
}
- if (f.scheme != SCM_NNTP && f.scheme != SCM_NEWS)
- UFclose(&f);
+ UFclose(&f);
if (fmInitialized)
term_raw();
signal(SIGINT, prevtrap);
@@ -2027,7 +2026,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
doFileSave(f, guess_save_name(t_buf, pu.file));
if (f.scheme == SCM_FTP)
FTPhalfclose(f.stream);
- else if (f.scheme != SCM_NNTP && f.scheme != SCM_NEWS)
+ else
UFclose(&f);
}
return NO_BUFFER;
@@ -2045,9 +2044,8 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
#endif
frame_source = flag & RG_FRAME_SRC;
b = loadSomething(&f, pu.real_file ? pu.real_file : pu.file, proc, t_buf);
+ UFclose(&f);
frame_source = 0;
- if (f.scheme != SCM_NNTP && f.scheme != SCM_NEWS)
- UFclose(&f);
if (b) {
b->real_scheme = f.scheme;
b->real_type = real_type;
diff --git a/html.h b/html.h
index 6f5ea11..af56799 100644
--- a/html.h
+++ b/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.19 2003/01/08 17:24:12 ukai Exp $ */
+/* $Id: html.h,v 1.20 2003/01/10 17:06:23 ukai Exp $ */
#ifndef _HTML_H
#define _HTML_H
#ifdef USE_SSL
@@ -14,7 +14,7 @@
#define UFgetc(f) ISgetc((f)->stream)
#define UFundogetc(f) ISundogetc((f)->stream)
#define UFread(f,buf,len) ISread((f)->stream,buf,len)
-#define UFclose(f) (ISclose((f)->stream), (f)->stream = NULL)
+#define UFclose(f) (ISclose((f)->stream) == 0 && ((f)->stream = NULL))
struct cmdtable {
char *cmdname;
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:
diff --git a/istream.h b/istream.h
index fa91d9b..dc60a0f 100644
--- a/istream.h
+++ b/istream.h
@@ -1,4 +1,4 @@
-/* $Id: istream.h,v 1.9 2002/09/28 16:30:07 ukai Exp $ */
+/* $Id: istream.h,v 1.10 2003/01/10 17:06:24 ukai Exp $ */
#ifndef IO_STREAM_H
#define IO_STREAM_H
@@ -116,7 +116,7 @@ extern InputStream newStrStream(Str s);
extern InputStream newSSLStream(SSL * ssl, int sock);
#endif
extern InputStream newEncodedStream(InputStream is, char encoding);
-extern void ISclose(InputStream stream);
+extern int ISclose(InputStream stream);
extern int ISgetc(InputStream stream);
extern int ISundogetc(InputStream stream);
extern Str StrISgets(InputStream stream);
@@ -134,6 +134,7 @@ extern Str ssl_get_certificate(SSL *ssl, char *hostname);
#define IST_STR 2
#define IST_SSL 3
#define IST_ENCODED 4
+#define IST_UNCLOSE 0x10
#define IStype(stream) ((stream)->base.type)
#define is_eos(stream) ISeos(stream)
diff --git a/news.c b/news.c
index 9da7e7b..f882529 100644
--- a/news.c
+++ b/news.c
@@ -1,4 +1,4 @@
-/* $Id: news.c,v 1.10 2003/01/07 15:56:41 ukai Exp $ */
+/* $Id: news.c,v 1.11 2003/01/10 17:06:25 ukai Exp $ */
#include "fm.h"
#include "myctype.h"
#include <stdio.h>
@@ -58,6 +58,7 @@ news_close(News * news)
if (!news->host)
return;
if (news->rf) {
+ IStype(news->rf) &= ~IST_UNCLOSE;
ISclose(news->rf);
news->rf = NULL;
}
@@ -80,6 +81,7 @@ news_open(News * news)
news->wf = fdopen(dup(sock), "wb");
if (!news->rf || !news->wf)
goto open_err;
+ IStype(news->rf) |= IST_UNCLOSE;
news_command(news, NULL, &status);
if (status != 200 && status != 201)
goto open_err;