Provide local-echo option.

Can be switched on with -e on the command line.
Can be toggled with Ctrl t e while program is running.
This commit is contained in:
Henner Zeller 2018-06-23 12:24:41 -07:00
parent 08fd18e803
commit dabd2130a9
6 changed files with 38 additions and 1 deletions

View file

@ -45,6 +45,7 @@ struct option_t option =
0, // No output delay
false, // No autoconnect
false, // No log
false, // No local echo
"", // Log filename
"" // Map string
};
@ -61,6 +62,7 @@ void print_help(char *argv[])
printf(" -p, --parity odd|even|none Parity (default: none)\n");
printf(" -o, --output-delay <ms> Output delay (default: 0)\n");
printf(" -n, --no-autoconnect Disable automatic connect\n");
printf(" -e, --local-echo Do local echo\n");
printf(" -l, --log <filename> Log to file\n");
printf(" -m, --map <flags> Map special characters\n");
printf(" -v, --version Display version\n");
@ -108,6 +110,7 @@ void parse_options(int argc, char *argv[])
{"stopbits", required_argument, 0, 's'},
{"parity", required_argument, 0, 'p'},
{"output-delay", required_argument, 0, 'o'},
{"local-echo", no_argument, 0, 'e'},
{"no-autoconnect", no_argument, 0, 'n'},
{"log", required_argument, 0, 'l'},
{"map", required_argument, 0, 'm'},
@ -120,7 +123,7 @@ void parse_options(int argc, char *argv[])
int option_index = 0;
/* Parse argument using getopt_long */
c = getopt_long(argc, argv, "b:d:f:s:p:o:nl:m:vh", long_options, &option_index);
c = getopt_long(argc, argv, "b:d:f:s:p:o:nl:m:vhe", long_options, &option_index);
/* Detect the end of the options */
if (c == -1)
@ -146,6 +149,10 @@ void parse_options(int argc, char *argv[])
option.databits = string_to_long(optarg);
break;
case 'e':
option.local_echo = true;
break;
case 'f':
option.flow = optarg;
break;