commit ed9d40c5174a9bb1cdfcb376e285fef09e8614c2
parent 5b44935de09ff4af259a67758dc933e499847e14
Author: ukai <ukai>
Date: Fri, 10 Jan 2003 16:16:44 +0000
[w3m-dev 03622] Re: Error occured while reset
* file.c (uncompress_stream): child process initialized
* terms.c (close_tty): close unless stdin,out,err
(reset_tty): flush_tty, close_tty
(write1): flush_tty
(refresh): flush_tty
(flush_tty): check ttyf
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
3 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,15 @@
2003-01-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03622] Re: Error occured while reset
+ * file.c (uncompress_stream): child process initialized
+ * terms.c (close_tty): close unless stdin,out,err
+ (reset_tty): flush_tty, close_tty
+ (write1): flush_tty
+ (refresh): flush_tty
+ (flush_tty): check ttyf
+
+2003-01-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03620] -m option and header
* buffer.c (reshapeBuffer): fix reading from stdin
fix -m option
diff --git a/file.c b/file.c
@@ -7808,6 +7808,10 @@ uncompress_stream(URLFile *uf, char **src)
/* fd1[0]: read, fd1[1]: write */
if ((pid1 = fork()) == 0) {
reset_signals();
+ signal(SIGINT, SIG_IGN);
+ close_tty();
+ QuietMessage = TRUE;
+ fmInitialized = FALSE;
close(fd1[0]);
if (tmpf) {
#ifdef USE_BINMODE_STREAM
@@ -7825,10 +7829,6 @@ uncompress_stream(URLFile *uf, char **src)
/* child */
int pid2;
int fd2[2];
- if (fmInitialized) {
- close_tty();
- fmInitialized = FALSE;
- }
if (pipe(fd2) < 0) {
close(fd1[1]);
UFclose(uf);
diff --git a/terms.c b/terms.c
@@ -362,12 +362,9 @@ typedef struct scline {
short eol;
} Screen;
-static
-TerminalMode d_ioval;
-static
-int tty;
-static
-FILE *ttyf;
+static TerminalMode d_ioval;
+static int tty = -1;
+static FILE *ttyf = NULL;
static
char bp[1024], funcstr[256];
@@ -556,7 +553,8 @@ set_cc(int spec, int val)
void
close_tty(void)
{
- close(tty);
+ if (tty > 2)
+ close(tty);
}
char *
@@ -582,10 +580,9 @@ reset_tty(void)
writestr(T_cl);
}
writestr(T_se); /* reset terminal */
- fflush(ttyf);
+ flush_tty();
TerminalSet(tty, &d_ioval);
- if (tty != 2)
- close(tty);
+ close_tty();
}
MySignalHandler
@@ -871,7 +868,7 @@ write1(char c)
putc(c, ttyf);
#endif /* not JP_CHARSET */
#ifdef SCREEN_DEBUG
- fflush(ttyf);
+ flush_tty();
#endif /* SCREEN_DEBUG */
return 0;
}
@@ -1427,7 +1424,7 @@ refresh(void)
#endif /* JP_CHARSET */
}
MOVE(CurLine, CurColumn);
- fflush(ttyf);
+ flush_tty();
}
void
@@ -2170,7 +2167,8 @@ mouse_inactive()
void
flush_tty()
{
- fflush(ttyf);
+ if (ttyf)
+ fflush(ttyf);
}
#ifdef USE_IMAGE