Rename EOL delay to Output line delay

This commit is contained in:
Martin Lund 2022-07-11 14:08:12 +02:00
parent 8b8dd373a7
commit 39af74f263
7 changed files with 45 additions and 40 deletions

View file

@ -68,7 +68,7 @@ The command-line interface is straightforward as reflected in the output from
-s, --stopbits 1|2 Stop bits (default: 1) -s, --stopbits 1|2 Stop bits (default: 1)
-p, --parity odd|even|none Parity (default: none) -p, --parity odd|even|none Parity (default: none)
-o, --output-delay <ms> Character output delay (default: 0) -o, --output-delay <ms> Character output delay (default: 0)
-O, --eol-delay <ms> EOL output delay (default: 0) -O, --output-line-delay <ms> Line output delay (default: 0)
--dtr-pulse-duration <ms> DTR pulse duration (default: 100) --dtr-pulse-duration <ms> DTR pulse duration (default: 100)
-n, --no-autoconnect Disable automatic connect -n, --no-autoconnect Disable automatic connect
-e, --local-echo Enable local echo -e, --local-echo Enable local echo

View file

@ -43,9 +43,9 @@ Set parity (default: none).
Set output delay [ms] inserted between each sent character (default: 0). Set output delay [ms] inserted between each sent character (default: 0).
.TP .TP
.BR \-O ", " "\-\-eol\-delay " \fI<ms> .BR \-O ", " "\-\-output\-line\-delay " \fI<ms>
Set EOL delay [ms] inserted between each sent line (default: 0). Set output delay [ms] inserted between each sent line (default: 0).
.TP .TP
.BR " \-\-dtr\-pulse\-duration " \fI<ms> .BR " \-\-dtr\-pulse\-duration " \fI<ms>
@ -271,8 +271,8 @@ Set stop bits
Set parity Set parity
.IP "\fBoutput-delay" .IP "\fBoutput-delay"
Set output delay Set output delay
.IP "\fBeol-delay" .IP "\fBoutput-line-delay"
Set EOL delay Set output line delay
.IP "\fBdtr-pulse-duration" .IP "\fBdtr-pulse-duration"
Set DTR pulse duration Set DTR pulse duration
.IP "\fBno-autoconnect" .IP "\fBno-autoconnect"

View file

@ -16,6 +16,7 @@ _tio()
-s --stopbits \ -s --stopbits \
-p --parity \ -p --parity \
-o --output-delay \ -o --output-delay \
-o --output-line-delay \
--dtr-pulse-duration \ --dtr-pulse-duration \
-n --no-autoconnect \ -n --no-autoconnect \
-e --local-echo \ -e --local-echo \
@ -56,7 +57,11 @@ _tio()
return 0 return 0
;; ;;
-o | --output-delay) -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 return 0
;; ;;
--dtr-pulse-duration) --dtr-pulse-duration)
@ -75,11 +80,11 @@ _tio()
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0 return 0
;; ;;
-l | --log-file) --log-file)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0 return 0
;; ;;
-l | --log-strip) --log-strip)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0 return 0
;; ;;

View file

@ -124,9 +124,9 @@ static int data_handler(void *user, const char *section, const char *name,
{ {
option.output_delay = atoi(value); 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")) else if (!strcmp(name, "dtr-pulse-duration"))
{ {

View file

@ -55,8 +55,8 @@ struct option_t option =
.stopbits = 1, .stopbits = 1,
.parity = "none", .parity = "none",
.output_delay = 0, .output_delay = 0,
.output_line_delay = 0,
.dtr_pulse_duration = 100, .dtr_pulse_duration = 100,
.eol_delay = 0,
.no_autoconnect = false, .no_autoconnect = false,
.log = false, .log = false,
.log_filename = NULL, .log_filename = NULL,
@ -80,9 +80,9 @@ void print_help(char *argv[])
printf(" -d, --databits 5|6|7|8 Data bits (default: 8)\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(" -f, --flow hard|soft|none Flow control (default: none)\n");
printf(" -s, --stopbits 1|2 Stop bits (default: 1)\n"); printf(" -s, --stopbits 1|2 Stop bits (default: 1)\n");
printf(" -p, --parity odd|even|none|mark Parity (default: none)\n"); printf(" -p, --parity odd|even|none|mark|space Parity (default: none)\n");
printf(" -o, --output-delay <ms> Output delay (default: 0)\n"); printf(" -o, --output-delay <ms> Output character delay (default: 0)\n");
printf(" -O, --eol-delay <ms> EOL output delay (default: 0)\n"); printf(" -O, --output-line-delay <ms> Output line delay (default: 0)\n");
printf(" --dtr-pulse-duration <ms> DTR pulse duration (default: 100)\n"); printf(" --dtr-pulse-duration <ms> DTR pulse duration (default: 100)\n");
printf(" -n, --no-autoconnect Disable automatic connect\n"); printf(" -n, --no-autoconnect Disable automatic connect\n");
printf(" -e, --local-echo Enable local echo\n"); printf(" -e, --local-echo Enable local echo\n");
@ -174,7 +174,7 @@ void options_print()
tio_printf(" Local echo: %s", option.local_echo ? "enabled" : "disabled"); tio_printf(" Local echo: %s", option.local_echo ? "enabled" : "disabled");
tio_printf(" Timestamp: %s", timestamp_state_to_string(option.timestamp)); tio_printf(" Timestamp: %s", timestamp_state_to_string(option.timestamp));
tio_printf(" Output delay: %d", option.output_delay); 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(" DTR pulse duration: %d", option.dtr_pulse_duration);
tio_printf(" Auto connect: %s", option.no_autoconnect ? "disabled" : "enabled"); tio_printf(" Auto connect: %s", option.no_autoconnect ? "disabled" : "enabled");
if (option.map[0] != 0) if (option.map[0] != 0)
@ -205,7 +205,7 @@ void options_parse(int argc, char *argv[])
{"stopbits", required_argument, 0, 's' }, {"stopbits", required_argument, 0, 's' },
{"parity", required_argument, 0, 'p' }, {"parity", required_argument, 0, 'p' },
{"output-delay", required_argument, 0, 'o' }, {"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}, {"dtr-pulse-duration", required_argument, 0, OPT_DTR_PULSE_DURATION},
{"no-autoconnect", no_argument, 0, 'n' }, {"no-autoconnect", no_argument, 0, 'n' },
{"local-echo", no_argument, 0, 'e' }, {"local-echo", no_argument, 0, 'e' },
@ -271,7 +271,7 @@ void options_parse(int argc, char *argv[])
break; break;
case 'O': case 'O':
option.eol_delay = string_to_long(optarg); option.output_line_delay = string_to_long(optarg);
break; break;
case OPT_DTR_PULSE_DURATION: case OPT_DTR_PULSE_DURATION:

View file

@ -48,8 +48,8 @@ struct option_t
int stopbits; int stopbits;
char *parity; char *parity;
int output_delay; int output_delay;
int output_line_delay;
int dtr_pulse_duration; int dtr_pulse_duration;
int eol_delay;
bool no_autoconnect; bool no_autoconnect;
bool log; bool log;
bool log_strip; bool log_strip;

View file

@ -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 // Write byte by byte with output delay
for (i=0; i<count; i++) for (i=0; i<count; i++)
@ -172,9 +172,9 @@ ssize_t tty_write(int fd, const void *buffer, size_t count)
} }
bytes_written += retval; bytes_written += retval;
if (option.eol_delay && *(unsigned char*)buffer == '\r') if (option.output_line_delay && *(unsigned char*)buffer == '\r')
{ {
delay(option.eol_delay); delay(option.output_line_delay);
} }
fsync(fd); fsync(fd);