mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Cleanup stdout flushing
Flushing is not needed since we disabled buffering of stdout.
This commit is contained in:
parent
4c611e6767
commit
a0f3f9d9b7
4 changed files with 1 additions and 11 deletions
|
|
@ -175,7 +175,6 @@ void log_close(void)
|
||||||
{
|
{
|
||||||
if (fp != NULL)
|
if (fp != NULL)
|
||||||
{
|
{
|
||||||
fflush(fp);
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,11 @@ char ansi_format[30];
|
||||||
void print_hex(char c)
|
void print_hex(char c)
|
||||||
{
|
{
|
||||||
printf("%02x ", (unsigned char) c);
|
printf("%02x ", (unsigned char) c);
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_normal(char c)
|
void print_normal(char c)
|
||||||
{
|
{
|
||||||
putchar(c);
|
putchar(c);
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_init_ansi_formatting()
|
void print_init_ansi_formatting()
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ extern char ansi_format[];
|
||||||
fprintf (stdout, "\r" format "\r\n", ## args); \
|
fprintf (stdout, "\r" format "\r\n", ## args); \
|
||||||
else \
|
else \
|
||||||
fprintf (stdout, "\r%s" format ANSI_RESET "\r\n", ansi_format, ## args); \
|
fprintf (stdout, "\r%s" format ANSI_RESET "\r\n", ansi_format, ## args); \
|
||||||
fflush(stdout); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ansi_error_printf(format, args...) \
|
#define ansi_error_printf(format, args...) \
|
||||||
|
|
@ -55,7 +54,6 @@ extern char ansi_format[];
|
||||||
fprintf (stdout, format, ## args); \
|
fprintf (stdout, format, ## args); \
|
||||||
else \
|
else \
|
||||||
fprintf (stdout, "%s" format ANSI_RESET, ansi_format, ## args); \
|
fprintf (stdout, "%s" format ANSI_RESET, ansi_format, ## args); \
|
||||||
fflush(stdout); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define warning_printf(format, args...) \
|
#define warning_printf(format, args...) \
|
||||||
|
|
@ -66,7 +64,6 @@ extern char ansi_format[];
|
||||||
fprintf (stdout, "\r[%s] Warning: " format "\r\n", current_time(), ## args); \
|
fprintf (stdout, "\r[%s] Warning: " format "\r\n", current_time(), ## args); \
|
||||||
else \
|
else \
|
||||||
ansi_printf("[%s] Warning: " format, current_time(), ## args); \
|
ansi_printf("[%s] Warning: " format, current_time(), ## args); \
|
||||||
fflush(stdout); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define tio_printf(format, args...) \
|
#define tio_printf(format, args...) \
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,6 @@ static void optional_local_echo(char c)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
print(c);
|
print(c);
|
||||||
fflush(stdout);
|
|
||||||
if (option.log)
|
if (option.log)
|
||||||
{
|
{
|
||||||
log_putc(c);
|
log_putc(c);
|
||||||
|
|
@ -255,7 +254,6 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
||||||
case KEY_L:
|
case KEY_L:
|
||||||
/* Clear screen using ANSI/VT100 escape code */
|
/* Clear screen using ANSI/VT100 escape code */
|
||||||
printf("\033c");
|
printf("\033c");
|
||||||
fflush(stdout);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_Q:
|
case KEY_Q:
|
||||||
|
|
@ -352,7 +350,7 @@ void stdout_configure(void)
|
||||||
|
|
||||||
/* Disable line buffering in stdout. This is necessary if we
|
/* Disable line buffering in stdout. This is necessary if we
|
||||||
* want things like local echo to work correctly. */
|
* want things like local echo to work correctly. */
|
||||||
setbuf(stdout, NULL);
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
|
||||||
/* Save current stdout settings */
|
/* Save current stdout settings */
|
||||||
if (tcgetattr(STDOUT_FILENO, &stdout_old) < 0)
|
if (tcgetattr(STDOUT_FILENO, &stdout_old) < 0)
|
||||||
|
|
@ -816,7 +814,6 @@ int tty_connect(void)
|
||||||
/* Print received tty character to stdout */
|
/* Print received tty character to stdout */
|
||||||
print(input_char);
|
print(input_char);
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
/* Write to log */
|
/* Write to log */
|
||||||
if (option.log)
|
if (option.log)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue