--- st.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/st.c b/st.c index 75c6cea..f4384b9 100644 --- a/st.c +++ b/st.c _AT_@ -352,7 +352,7 @@ static STREscape strescseq; static int cmdfd; static pid_t pid; static Selection sel; -static FILE *fileio; +static int iofd = -1; static char **opt_cmd = NULL; static char *opt_io = NULL; static char *opt_title = NULL; _AT_@ -803,9 +803,9 @@ ttynew(void) { signal(SIGCHLD, sigchld); if(opt_io) { if(!strcmp(opt_io, "-")) { - fileio = stdout; + iofd = STDOUT_FILENO; } else { - if(!(fileio = fopen(opt_io, "w"))) { + if((iofd = open(opt_io, O_WRONLY | O_CREAT, 0666)) < 0) { fprintf(stderr, "Error opening %s:%s\n", opt_io, strerror(errno)); } _AT_@ -1581,10 +1581,8 @@ void tputc(char *c) { char ascii = *c; - if(fileio) { - putc(ascii, fileio); - fflush(fileio); - } + if(iofd != -1) + write(iofd, c, 1); if(term.esc & ESC_START) { if(term.esc & ESC_CSI) { -- 1.7.10.4 --wac7ysb48OaltWcw--Received on Mon Sep 17 2001 - 00:00:00 CEST
This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:36:02 CEST