mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Add key command to toggle log on/off
Add key command 'ctrl-t f' which will toggle log on/off. If no log filename has been specified via the 'log-filename' option then tio will automatically generate a new log filename every time the log feature is toggled on. Meaning, when toggled multiple times, multiple log files will be generated. However, if a log filename has been specified, tio will only write and append to that same file.
This commit is contained in:
parent
a4f0d4da53
commit
419fbdc3fa
6 changed files with 58 additions and 26 deletions
18
src/tty.c
18
src/tty.c
|
|
@ -80,6 +80,7 @@
|
|||
#define KEY_B 0x62
|
||||
#define KEY_C 0x63
|
||||
#define KEY_E 0x65
|
||||
#define KEY_F 0x66
|
||||
#define KEY_G 0x67
|
||||
#define KEY_H 0x68
|
||||
#define KEY_L 0x6C
|
||||
|
|
@ -414,6 +415,7 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
|||
tio_printf(" ctrl-%c b Send break", option.prefix_key);
|
||||
tio_printf(" ctrl-%c c Show configuration", option.prefix_key);
|
||||
tio_printf(" ctrl-%c e Toggle local echo mode", option.prefix_key);
|
||||
tio_printf(" ctrl-%c f Toggle log to file", option.prefix_key);
|
||||
tio_printf(" ctrl-%c g Toggle serial port line", option.prefix_key);
|
||||
tio_printf(" ctrl-%c h Toggle hexadecimal mode", option.prefix_key);
|
||||
tio_printf(" ctrl-%c l Clear screen", option.prefix_key);
|
||||
|
|
@ -443,6 +445,22 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
|||
tio_printf(" RI : %s", (state & TIOCM_RI) ? "HIGH" : "LOW");
|
||||
break;
|
||||
|
||||
case KEY_F:
|
||||
if (option.log)
|
||||
{
|
||||
log_close();
|
||||
option.log = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (log_open(option.log_filename) == 0)
|
||||
{
|
||||
option.log = true;
|
||||
}
|
||||
}
|
||||
tio_printf("Switched log to file %s", option.log ? "on" : "off");
|
||||
break;
|
||||
|
||||
case KEY_G:
|
||||
tio_printf("Please enter which serial line number to toggle:");
|
||||
tio_printf(" DTR (0)");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue