X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=7852de0745f3bac16ee4947ab963172a4bdc1f03;hb=a1cd28f8099eac3938461f9e63ff6b74d4d824ef;hp=165d930461379282b1d8719dcffc4e3aca9252dc;hpb=4a4ae19158a6d18d63b8e9fce92e6e5e45543746;p=st.git diff --git a/st.c b/st.c index 165d930..7852de0 100644 --- a/st.c +++ b/st.c @@ -801,9 +801,15 @@ ttynew(void) { close(s); cmdfd = m; signal(SIGCHLD, sigchld); - if(opt_io && !(fileio = fopen(opt_io, "w"))) { - fprintf(stderr, "Error opening %s:%s\n", - opt_io, strerror(errno)); + if(opt_io) { + if(!strcmp(opt_io, "-")) { + fileio = stdout; + } else { + if(!(fileio = fopen(opt_io, "w"))) { + fprintf(stderr, "Error opening %s:%s\n", + opt_io, strerror(errno)); + } + } } } } @@ -1127,7 +1133,8 @@ tsetattr(int *attr, int l) { for(i = 0; i < l; i++) { switch(attr[i]) { case 0: - term.c.attr.mode &= ~(ATTR_REVERSE | ATTR_UNDERLINE | ATTR_BOLD); + term.c.attr.mode &= ~(ATTR_REVERSE | ATTR_UNDERLINE | ATTR_BOLD \ + | ATTR_ITALIC); term.c.attr.fg = DefaultFG; term.c.attr.bg = DefaultBG; break; @@ -1565,8 +1572,10 @@ void tputc(char *c) { char ascii = *c; - if(fileio) + if(fileio) { putc(ascii, fileio); + fflush(fileio); + } if(term.esc & ESC_START) { if(term.esc & ESC_CSI) {