From 8ddabb1908fa9dafe52a5fd84caa41a0769039f5 Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Fri, 20 May 2016 19:36:23 +0200 Subject: [PATCH] Improved tio output Added titles and indentation to commands output for clearer separation when firing commands repeatedly. Also added print of tio version and quit command hint at launch. --- src/tty.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/tty.c b/src/tty.c index 289971e..a701e81 100644 --- a/src/tty.c +++ b/src/tty.c @@ -32,6 +32,7 @@ #include #include #include +#include "config.h" #include "tio/tty.h" #include "tio/print.h" #include "tio/options.h" @@ -69,15 +70,18 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c switch (input_char) { case KEY_I: - tio_printf("TTY device: %s", option.tty_device); - tio_printf("Baudrate: %d", option.baudrate); - tio_printf("Databits: %d", option.databits); - tio_printf("Flow: %s", option.flow); - tio_printf("Stopbits: %d", option.stopbits); - tio_printf("Parity: %s", option.parity); - tio_printf("Output delay: %d", option.output_delay); + tio_printf("Settings information:"); + tio_printf(" TTY device: %s", option.tty_device); + tio_printf(" Baudrate: %d", option.baudrate); + tio_printf(" Databits: %d", option.databits); + tio_printf(" Flow: %s", option.flow); + tio_printf(" Stopbits: %d", option.stopbits); + tio_printf(" Parity: %s", option.parity); + tio_printf(" Output delay: %d", option.output_delay); if (option.log) - tio_printf("Log file: %s", option.log_filename); + { + tio_printf(" Log file: %s", option.log_filename); + } *forward = false; break; case KEY_Q: @@ -89,7 +93,8 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c break; case KEY_S: /* Show tx/rx statistics upon ctrl-t s sequence */ - tio_printf("Sent %ld bytes, received %ld bytes", tx_total, rx_total); + tio_printf("Statistics:"); + tio_printf(" Sent %ld bytes, received %ld bytes", tx_total, rx_total); *forward = false; break; default: @@ -116,6 +121,10 @@ void wait_for_tty_device(void) /* Don't wait first time */ tv.tv_sec = 0; tv.tv_usec = 1; + + tio_printf("tio v%s", VERSION); + tio_printf("Press ctrl-t + q to quit"); + first = false; } else {