mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Replace -U,--upcase with mapping flag OLTU
This commit is contained in:
parent
555e526ce7
commit
11762b2300
6 changed files with 17 additions and 30 deletions
|
|
@ -128,10 +128,6 @@ static int data_handler(void *user, const char *section, const char *name,
|
|||
{
|
||||
option.eol_delay = atoi(value);
|
||||
}
|
||||
else if ( !strcmp(name, "upcase"))
|
||||
{
|
||||
option.upcase = true;
|
||||
}
|
||||
else if (!strcmp(name, "dtr-pulse-duration"))
|
||||
{
|
||||
option.dtr_pulse_duration = atoi(value);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ struct option_t option =
|
|||
.output_delay = 0,
|
||||
.dtr_pulse_duration = 100,
|
||||
.eol_delay = 0,
|
||||
.upcase = false,
|
||||
.no_autoconnect = false,
|
||||
.log = false,
|
||||
.log_filename = NULL,
|
||||
|
|
@ -93,11 +92,10 @@ void print_help(char *argv[])
|
|||
printf(" -l, --log Enable log to file\n");
|
||||
printf(" --log-file <filename> Set log filename\n");
|
||||
printf(" --log-strip Strip control characters and escape sequences\n");
|
||||
printf(" -m, --map <flags> Map special characters\n");
|
||||
printf(" -m, --map <flags> Map characters\n");
|
||||
printf(" -c, --color 0..255|none|list Colorize tio text (default: 15)\n");
|
||||
printf(" -S, --socket <socket> Redirect I/O to file or network socket\n");
|
||||
printf(" -x, --hexadecimal Enable hexadecimal mode\n");
|
||||
printf(" -U, --upcase Translate lower case alpha to upper case\n");
|
||||
printf(" -v, --version Display version\n");
|
||||
printf(" -h, --help Display help\n");
|
||||
printf("\n");
|
||||
|
|
@ -177,7 +175,6 @@ void options_print()
|
|||
tio_printf(" Timestamp: %s", timestamp_state_to_string(option.timestamp));
|
||||
tio_printf(" Output delay: %d", option.output_delay);
|
||||
tio_printf(" EOL delay: %d", option.eol_delay);
|
||||
tio_printf(" Upcase: %s", option.upcase ? "enabled" : "disabled");
|
||||
tio_printf(" DTR pulse duration: %d", option.dtr_pulse_duration);
|
||||
tio_printf(" Auto connect: %s", option.no_autoconnect ? "disabled" : "enabled");
|
||||
if (option.map[0] != 0)
|
||||
|
|
@ -209,7 +206,6 @@ void options_parse(int argc, char *argv[])
|
|||
{"parity", required_argument, 0, 'p' },
|
||||
{"output-delay", required_argument, 0, 'o' },
|
||||
{"eol-delay", required_argument, 0, 'O' },
|
||||
{"upcase", no_argument, 0, 'U' },
|
||||
{"dtr-pulse-duration", required_argument, 0, OPT_DTR_PULSE_DURATION },
|
||||
{"no-autoconnect", no_argument, 0, 'n' },
|
||||
{"local-echo", no_argument, 0, 'e' },
|
||||
|
|
@ -232,7 +228,7 @@ void options_parse(int argc, char *argv[])
|
|||
int option_index = 0;
|
||||
|
||||
/* Parse argument using getopt_long */
|
||||
c = getopt_long(argc, argv, "b:d:f:s:p:o:O:UnetLlS:m:c:xvh", long_options, &option_index);
|
||||
c = getopt_long(argc, argv, "b:d:f:s:p:o:O:netLlS:m:c:xvh", long_options, &option_index);
|
||||
|
||||
/* Detect the end of the options */
|
||||
if (c == -1)
|
||||
|
|
@ -353,10 +349,6 @@ void options_parse(int argc, char *argv[])
|
|||
option.hex_mode = true;
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
option.upcase = true;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
printf("tio v%s\n", VERSION);
|
||||
printf("Copyright (c) 2014-2022 Martin Lund\n");
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ struct option_t
|
|||
int output_delay;
|
||||
int dtr_pulse_duration;
|
||||
int eol_delay;
|
||||
bool upcase;
|
||||
bool no_autoconnect;
|
||||
bool log;
|
||||
bool log_strip;
|
||||
|
|
|
|||
11
src/tty.c
11
src/tty.c
|
|
@ -77,6 +77,7 @@ static bool map_i_nl_crnl = false;
|
|||
static bool map_o_cr_nl = false;
|
||||
static bool map_o_nl_crnl = false;
|
||||
static bool map_o_del_bs = false;
|
||||
static bool map_o_ltu = false;
|
||||
static char hex_chars[2];
|
||||
static unsigned char hex_char_index = 0;
|
||||
static char tty_buffer[BUFSIZ*2];
|
||||
|
|
@ -148,7 +149,7 @@ ssize_t tty_write(int fd, const void *buffer, size_t count)
|
|||
ssize_t retval = 0, bytes_written = 0;
|
||||
size_t i;
|
||||
|
||||
if (option.upcase)
|
||||
if (map_o_ltu)
|
||||
{
|
||||
// Convert lower case to upper case
|
||||
for (i = 0; i<count; i++)
|
||||
|
|
@ -287,7 +288,7 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
|||
tio_printf(" ctrl-t s Show statistics");
|
||||
tio_printf(" ctrl-t t Send ctrl-t key code");
|
||||
tio_printf(" ctrl-t T Toggle line timestamp mode");
|
||||
tio_printf(" ctrl-t U Toggle conversion to upper case");
|
||||
tio_printf(" ctrl-t U Toggle conversion to uppercase");
|
||||
tio_printf(" ctrl-t v Show version");
|
||||
break;
|
||||
|
||||
|
|
@ -398,7 +399,7 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
|||
break;
|
||||
|
||||
case KEY_U:
|
||||
option.upcase = !option.upcase;
|
||||
map_o_ltu = !map_o_ltu;
|
||||
break;
|
||||
|
||||
case KEY_V:
|
||||
|
|
@ -686,6 +687,10 @@ void tty_configure(void)
|
|||
{
|
||||
map_o_nl_crnl = true;
|
||||
}
|
||||
else if (strcmp(token, "OLTU") == 0)
|
||||
{
|
||||
map_o_ltu = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error: Unknown mapping flag %s\n", token);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue