By default text files are line buffered, and this means that -f option will
not write the line until a \n is printed. This is not very useful for
debugging, so a call to fflush was added. This patch substitute this call
(which will be done by each character painted) by the full remove of the
buffering in the file.
---
st.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
static int cmdfd;
static pid_t pid;
static Selection sel;
static int cmdfd;
static pid_t pid;
static Selection sel;
static char **opt_cmd = NULL;
static char *opt_io = NULL;
static char *opt_title = NULL;
static char **opt_cmd = NULL;
static char *opt_io = NULL;
static char *opt_title = NULL;
signal(SIGCHLD, sigchld);
if(opt_io) {
if(!strcmp(opt_io, "-")) {
signal(SIGCHLD, sigchld);
if(opt_io) {
if(!strcmp(opt_io, "-")) {
- 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));
}
fprintf(stderr, "Error opening %s:%s\n",
opt_io, strerror(errno));
}
tputc(char *c) {
char ascii = *c;
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) {
if(term.esc & ESC_START) {
if(term.esc & ESC_CSI) {