Minor code style cleanups

This commit is contained in:
Martin Lund 2018-11-03 16:40:59 +01:00
parent f96ad43b1f
commit a5d1546024

View file

@ -579,7 +579,8 @@ int tty_connect(void)
connected = true; connected = true;
tainted = false; tainted = false;
if (option.timestamp) next_timestamp = time(NULL); if (option.timestamp)
next_timestamp = time(NULL);
/* Save current port settings */ /* Save current port settings */
if (tcgetattr(fd, &tio_old) < 0) if (tcgetattr(fd, &tio_old) < 0)
@ -633,7 +634,8 @@ int tty_connect(void)
rx_total++; rx_total++;
/* Print timestamp on new line, if desired. */ /* Print timestamp on new line, if desired. */
if (next_timestamp && input_char != '\n' && input_char != '\r') { if (next_timestamp && input_char != '\n' && input_char != '\r')
{
fprintf(stdout, ANSI_COLOR_GRAY "[%s] " ANSI_COLOR_RESET, current_time()); fprintf(stdout, ANSI_COLOR_GRAY "[%s] " ANSI_COLOR_RESET, current_time());
next_timestamp = 0; next_timestamp = 0;
} }
@ -643,7 +645,8 @@ int tty_connect(void)
{ {
print('\r'); print('\r');
print('\n'); print('\n');
if (option.timestamp) next_timestamp = time(NULL); if (option.timestamp)
next_timestamp = time(NULL);
} else } else
{ {
/* Print received tty character to stdout */ /* Print received tty character to stdout */
@ -657,7 +660,8 @@ int tty_connect(void)
tainted = true; tainted = true;
if (input_char == '\n' && option.timestamp) next_timestamp = time(NULL); if (input_char == '\n' && option.timestamp)
next_timestamp = time(NULL);
} else } else
{ {
/* Error reading - device is likely unplugged */ /* Error reading - device is likely unplugged */