From 39af74f26348de482529d795511bee5d52c6ec99 Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Mon, 11 Jul 2022 14:08:12 +0200 Subject: [PATCH] Rename EOL delay to Output line delay --- README.md | 2 +- man/tio.1.in | 8 +++--- src/bash-completion/tio.in | 11 +++++--- src/configfile.c | 4 +-- src/options.c | 52 +++++++++++++++++++------------------- src/options.h | 2 +- src/tty.c | 6 ++--- 7 files changed, 45 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 3a39b91..317ed58 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ The command-line interface is straightforward as reflected in the output from -s, --stopbits 1|2 Stop bits (default: 1) -p, --parity odd|even|none Parity (default: none) -o, --output-delay Character output delay (default: 0) - -O, --eol-delay EOL output delay (default: 0) + -O, --output-line-delay Line output delay (default: 0) --dtr-pulse-duration DTR pulse duration (default: 100) -n, --no-autoconnect Disable automatic connect -e, --local-echo Enable local echo diff --git a/man/tio.1.in b/man/tio.1.in index 82971fc..dc79b41 100644 --- a/man/tio.1.in +++ b/man/tio.1.in @@ -43,9 +43,9 @@ Set parity (default: none). Set output delay [ms] inserted between each sent character (default: 0). .TP -.BR \-O ", " "\-\-eol\-delay " \fI +.BR \-O ", " "\-\-output\-line\-delay " \fI -Set EOL delay [ms] inserted between each sent line (default: 0). +Set output delay [ms] inserted between each sent line (default: 0). .TP .BR " \-\-dtr\-pulse\-duration " \fI @@ -271,8 +271,8 @@ Set stop bits Set parity .IP "\fBoutput-delay" Set output delay -.IP "\fBeol-delay" -Set EOL delay +.IP "\fBoutput-line-delay" +Set output line delay .IP "\fBdtr-pulse-duration" Set DTR pulse duration .IP "\fBno-autoconnect" diff --git a/src/bash-completion/tio.in b/src/bash-completion/tio.in index 320601c..6ed5520 100644 --- a/src/bash-completion/tio.in +++ b/src/bash-completion/tio.in @@ -16,6 +16,7 @@ _tio() -s --stopbits \ -p --parity \ -o --output-delay \ + -o --output-line-delay \ --dtr-pulse-duration \ -n --no-autoconnect \ -e --local-echo \ @@ -56,7 +57,11 @@ _tio() return 0 ;; -o | --output-delay) - COMPREPLY=( $(compgen -W "0 1 10 100" -- ${cur}) ) + COMPREPLY=( $(compgen -W "1 10 100" -- ${cur}) ) + return 0 + ;; + -O | --output-line-delay) + COMPREPLY=( $(compgen -W "1 10 100" -- ${cur}) ) return 0 ;; --dtr-pulse-duration) @@ -75,11 +80,11 @@ _tio() COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; - -l | --log-file) + --log-file) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; - -l | --log-strip) + --log-strip) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; diff --git a/src/configfile.c b/src/configfile.c index e858aab..1d241ec 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -124,9 +124,9 @@ static int data_handler(void *user, const char *section, const char *name, { option.output_delay = atoi(value); } - else if (!strcmp(name, "eol-delay")) + else if (!strcmp(name, "output-line-delay")) { - option.eol_delay = atoi(value); + option.output_line_delay = atoi(value); } else if (!strcmp(name, "dtr-pulse-duration")) { diff --git a/src/options.c b/src/options.c index 58cb555..1b2c912 100644 --- a/src/options.c +++ b/src/options.c @@ -55,8 +55,8 @@ struct option_t option = .stopbits = 1, .parity = "none", .output_delay = 0, + .output_line_delay = 0, .dtr_pulse_duration = 100, - .eol_delay = 0, .no_autoconnect = false, .log = false, .log_filename = NULL, @@ -76,28 +76,28 @@ void print_help(char *argv[]) printf("Connect to tty device directly or via sub-configuration.\n"); printf("\n"); printf("Options:\n"); - printf(" -b, --baudrate Baud rate (default: 115200)\n"); - printf(" -d, --databits 5|6|7|8 Data bits (default: 8)\n"); - printf(" -f, --flow hard|soft|none Flow control (default: none)\n"); - printf(" -s, --stopbits 1|2 Stop bits (default: 1)\n"); - printf(" -p, --parity odd|even|none|mark Parity (default: none)\n"); - printf(" -o, --output-delay Output delay (default: 0)\n"); - printf(" -O, --eol-delay EOL output delay (default: 0)\n"); - printf(" --dtr-pulse-duration DTR pulse duration (default: 100)\n"); - printf(" -n, --no-autoconnect Disable automatic connect\n"); - printf(" -e, --local-echo Enable local echo\n"); - printf(" -t, --timestamp Enable line timestamp\n"); - printf(" --timestamp-format Set timestamp format (default: 24hour)\n"); - printf(" -L, --list-devices List available serial devices\n"); - printf(" -l, --log Enable log to file\n"); - printf(" --log-file Set log filename\n"); - printf(" --log-strip Strip control characters and escape sequences\n"); - printf(" -m, --map Map characters\n"); - printf(" -c, --color 0..255|none|list Colorize tio text (default: 15)\n"); - printf(" -S, --socket Redirect I/O to file or network socket\n"); - printf(" -x, --hexadecimal Enable hexadecimal mode\n"); - printf(" -v, --version Display version\n"); - printf(" -h, --help Display help\n"); + printf(" -b, --baudrate Baud rate (default: 115200)\n"); + printf(" -d, --databits 5|6|7|8 Data bits (default: 8)\n"); + printf(" -f, --flow hard|soft|none Flow control (default: none)\n"); + printf(" -s, --stopbits 1|2 Stop bits (default: 1)\n"); + printf(" -p, --parity odd|even|none|mark|space Parity (default: none)\n"); + printf(" -o, --output-delay Output character delay (default: 0)\n"); + printf(" -O, --output-line-delay Output line delay (default: 0)\n"); + printf(" --dtr-pulse-duration DTR pulse duration (default: 100)\n"); + printf(" -n, --no-autoconnect Disable automatic connect\n"); + printf(" -e, --local-echo Enable local echo\n"); + printf(" -t, --timestamp Enable line timestamp\n"); + printf(" --timestamp-format Set timestamp format (default: 24hour)\n"); + printf(" -L, --list-devices List available serial devices\n"); + printf(" -l, --log Enable log to file\n"); + printf(" --log-file Set log filename\n"); + printf(" --log-strip Strip control characters and escape sequences\n"); + printf(" -m, --map Map characters\n"); + printf(" -c, --color 0..255|none|list Colorize tio text (default: 15)\n"); + printf(" -S, --socket Redirect I/O to file or network socket\n"); + printf(" -x, --hexadecimal Enable hexadecimal mode\n"); + printf(" -v, --version Display version\n"); + printf(" -h, --help Display help\n"); printf("\n"); printf("Options and sub-configurations may be set via configuration file.\n"); printf("\n"); @@ -174,7 +174,7 @@ void options_print() tio_printf(" Local echo: %s", option.local_echo ? "enabled" : "disabled"); 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(" Output line delay: %d", option.output_line_delay); 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) @@ -205,7 +205,7 @@ void options_parse(int argc, char *argv[]) {"stopbits", required_argument, 0, 's' }, {"parity", required_argument, 0, 'p' }, {"output-delay", required_argument, 0, 'o' }, - {"eol-delay", required_argument, 0, 'O' }, + {"output-line-delay", required_argument, 0, 'O' }, {"dtr-pulse-duration", required_argument, 0, OPT_DTR_PULSE_DURATION}, {"no-autoconnect", no_argument, 0, 'n' }, {"local-echo", no_argument, 0, 'e' }, @@ -271,7 +271,7 @@ void options_parse(int argc, char *argv[]) break; case 'O': - option.eol_delay = string_to_long(optarg); + option.output_line_delay = string_to_long(optarg); break; case OPT_DTR_PULSE_DURATION: diff --git a/src/options.h b/src/options.h index 66573d0..3aecbe4 100644 --- a/src/options.h +++ b/src/options.h @@ -48,8 +48,8 @@ struct option_t int stopbits; char *parity; int output_delay; + int output_line_delay; int dtr_pulse_duration; - int eol_delay; bool no_autoconnect; bool log; bool log_strip; diff --git a/src/tty.c b/src/tty.c index e9d345e..5c6c7af 100644 --- a/src/tty.c +++ b/src/tty.c @@ -158,7 +158,7 @@ ssize_t tty_write(int fd, const void *buffer, size_t count) } } - if (option.output_delay || option.eol_delay) + if (option.output_delay || option.output_line_delay) { // Write byte by byte with output delay for (i=0; i