---
st.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff -r 2a91ba0148f3 -r 57218df89123 st.c
--- a/st.c Wed Sep 12 21:25:35 2012 +0200
+++ b/st.c Wed Sep 12 21:51:55 2012 +0200
_AT_@ -355,7 +355,7 @@
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_@ -821,9 +821,9 @@
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_@ -1599,10 +1599,8 @@
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) {
Received on Wed Sep 12 2012 - 21:53:59 CEST
This archive was generated by hypermail 2.3.0 : Wed Sep 12 2012 - 22:00:07 CEST