diff --git a/src/log.c b/src/log.c index 64a296f..b1577ec 100644 --- a/src/log.c +++ b/src/log.c @@ -175,7 +175,6 @@ void log_close(void) { if (fp != NULL) { - fflush(fp); fclose(fp); } } diff --git a/src/print.c b/src/print.c index 7580c31..68e663c 100644 --- a/src/print.c +++ b/src/print.c @@ -30,14 +30,11 @@ char ansi_format[30]; void print_hex(char c) { printf("%02x ", (unsigned char) c); - - fflush(stdout); } void print_normal(char c) { putchar(c); - fflush(stdout); } void print_init_ansi_formatting() diff --git a/src/print.h b/src/print.h index 28592fc..53c7eea 100644 --- a/src/print.h +++ b/src/print.h @@ -37,7 +37,6 @@ extern char ansi_format[]; fprintf (stdout, "\r" format "\r\n", ## args); \ else \ fprintf (stdout, "\r%s" format ANSI_RESET "\r\n", ansi_format, ## args); \ - fflush(stdout); \ } #define ansi_error_printf(format, args...) \ @@ -55,7 +54,6 @@ extern char ansi_format[]; fprintf (stdout, format, ## args); \ else \ fprintf (stdout, "%s" format ANSI_RESET, ansi_format, ## args); \ - fflush(stdout); \ } #define warning_printf(format, args...) \ @@ -66,7 +64,6 @@ extern char ansi_format[]; fprintf (stdout, "\r[%s] Warning: " format "\r\n", current_time(), ## args); \ else \ ansi_printf("[%s] Warning: " format, current_time(), ## args); \ - fflush(stdout); \ } #define tio_printf(format, args...) \ diff --git a/src/tty.c b/src/tty.c index b0780fc..f1f78c0 100644 --- a/src/tty.c +++ b/src/tty.c @@ -86,7 +86,6 @@ static void optional_local_echo(char c) return; } print(c); - fflush(stdout); if (option.log) { log_putc(c); @@ -255,7 +254,6 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c case KEY_L: /* Clear screen using ANSI/VT100 escape code */ printf("\033c"); - fflush(stdout); break; case KEY_Q: @@ -352,7 +350,7 @@ void stdout_configure(void) /* Disable line buffering in stdout. This is necessary if we * want things like local echo to work correctly. */ - setbuf(stdout, NULL); + setvbuf(stdout, NULL, _IONBF, 0); /* Save current stdout settings */ if (tcgetattr(STDOUT_FILENO, &stdout_old) < 0) @@ -816,7 +814,6 @@ int tty_connect(void) /* Print received tty character to stdout */ print(input_char); } - fflush(stdout); /* Write to log */ if (option.log)