mirror of
https://github.com/tio/tio.git
synced 2026-05-01 23:07:58 +02:00
Code cleanup
This commit is contained in:
parent
b95df7712b
commit
c257126a33
1 changed files with 4 additions and 7 deletions
11
src/tty.c
11
src/tty.c
|
|
@ -83,6 +83,9 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
||||||
/* Handle escape key commands */
|
/* Handle escape key commands */
|
||||||
if (previous_char == KEY_CTRL_T)
|
if (previous_char == KEY_CTRL_T)
|
||||||
{
|
{
|
||||||
|
/* Do not forward input char to output by default */
|
||||||
|
*forward = false;
|
||||||
|
|
||||||
switch (input_char)
|
switch (input_char)
|
||||||
{
|
{
|
||||||
case KEY_QUESTION:
|
case KEY_QUESTION:
|
||||||
|
|
@ -95,12 +98,10 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
||||||
tio_printf(" ctrl-t q Quit");
|
tio_printf(" ctrl-t q Quit");
|
||||||
tio_printf(" ctrl-t s Show statistics");
|
tio_printf(" ctrl-t s Show statistics");
|
||||||
tio_printf(" ctrl-t t Send ctrl-t key code");
|
tio_printf(" ctrl-t t Send ctrl-t key code");
|
||||||
*forward = false;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_B:
|
case KEY_B:
|
||||||
tcsendbreak(fd, 0);
|
tcsendbreak(fd, 0);
|
||||||
*forward = false;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_C:
|
case KEY_C:
|
||||||
|
|
@ -114,7 +115,6 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
||||||
tio_printf(" Output delay: %d", option.output_delay);
|
tio_printf(" Output delay: %d", option.output_delay);
|
||||||
if (option.log)
|
if (option.log)
|
||||||
tio_printf(" Log file: %s", option.log_filename);
|
tio_printf(" Log file: %s", option.log_filename);
|
||||||
*forward = false;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_H:
|
case KEY_H:
|
||||||
|
|
@ -131,12 +131,10 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
||||||
print_mode = NORMAL;
|
print_mode = NORMAL;
|
||||||
tio_printf("Switched to normal mode");
|
tio_printf("Switched to normal mode");
|
||||||
}
|
}
|
||||||
*forward = false;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_L:
|
case KEY_L:
|
||||||
status = system("clear");
|
status = system("clear");
|
||||||
*forward = false;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_Q:
|
case KEY_Q:
|
||||||
|
|
@ -147,17 +145,16 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
||||||
/* Show tx/rx statistics upon ctrl-t s sequence */
|
/* Show tx/rx statistics upon ctrl-t s sequence */
|
||||||
tio_printf("Statistics:");
|
tio_printf("Statistics:");
|
||||||
tio_printf(" Sent %lu bytes, received %lu bytes", tx_total, rx_total);
|
tio_printf(" Sent %lu bytes, received %lu bytes", tx_total, rx_total);
|
||||||
*forward = false;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_T:
|
case KEY_T:
|
||||||
/* Send ctrl-t key code upon ctrl-t t sequence */
|
/* Send ctrl-t key code upon ctrl-t t sequence */
|
||||||
*output_char = KEY_CTRL_T;
|
*output_char = KEY_CTRL_T;
|
||||||
|
*forward = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Ignore unknown ctrl-t escaped keys */
|
/* Ignore unknown ctrl-t escaped keys */
|
||||||
*forward = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue