1
0
mirror of https://github.com/UzixLS/picocom.git synced 2025-07-19 07:21:18 +03:00

Added the --no-escape command-line option

Disables the escape character so that picocom can never enter command
mode.
This commit is contained in:
Nick Patavalis
2017-12-16 18:11:33 +02:00
parent 8110b68477
commit 49041a2ef6
2 changed files with 21 additions and 3 deletions

View File

@ -197,6 +197,13 @@ Picocom accepts the following command-line options.
(see description above). If **x** is given, then **C-x** will make
picocom enter command mode. (Default: **a**)
**--no-escape** | **-n**
: Disables the escape character. Picocom will never enter
command-mode if this option is enabled. To exit picocom, either
close its standard input, or send it the TERM or INT
signal. (Default: Disabled).
**--echo** | **-c**
: Enable local echo. Every character being read from the terminal

View File

@ -185,6 +185,7 @@ struct {
int nolock;
#endif
unsigned char escape;
int noescape;
char send_cmd[128];
char receive_cmd[128];
int imap;
@ -211,6 +212,7 @@ struct {
.nolock = 0,
#endif
.escape = CKEY('a'),
.noescape = 0,
.send_cmd = "sz -vv",
.receive_cmd = "rz -vv -E",
.imap = M_I_DFL,
@ -1230,7 +1232,7 @@ loop(void)
state = ST_TRANSPARENT;
break;
case ST_TRANSPARENT:
if ( c == opts.escape )
if ( ! opts.noescape && c == opts.escape )
state = ST_COMMAND;
else
if ( tty_q_push((char *)&c, 1) != 1 )
@ -1370,6 +1372,7 @@ show_usage(char *name)
printf(" --<d>atabits 5 | 6 | 7 | 8\n");
printf(" --sto<p>bits 1 | 2\n");
printf(" --<e>scape <char>\n");
printf(" --<n>o-escape\n");
printf(" --e<c>ho\n");
printf(" --no<i>nit\n");
printf(" --no<r>eset\n");
@ -1417,6 +1420,7 @@ parse_args(int argc, char *argv[])
{"omap", required_argument, 0, 'O' },
{"emap", required_argument, 0, 'E' },
{"escape", required_argument, 0, 'e'},
{"no-escape", no_argument, 0, 'n'},
{"echo", no_argument, 0, 'c'},
{"noinit", no_argument, 0, 'i'},
{"noreset", no_argument, 0, 'r'},
@ -1447,7 +1451,7 @@ parse_args(int argc, char *argv[])
/* no default error messages printed. */
opterr = 0;
c = getopt_long(argc, argv, "hirlcqXv:s:r:e:f:b:y:d:p:g:t:x:",
c = getopt_long(argc, argv, "hirlcqXnv:s:r:e:f:b:y:d:p:g:t:x:",
longOptions, &optionIndex);
if (c < 0)
@ -1494,6 +1498,9 @@ parse_args(int argc, char *argv[])
case 'e':
opts.escape = CKEY(optarg[0]);
break;
case 'n':
opts.noescape = 1;
break;
case 'f':
switch (optarg[0]) {
case 'X':
@ -1660,7 +1667,11 @@ parse_args(int argc, char *argv[])
printf("parity is : %s\n", parity_str[opts.parity]);
printf("databits are : %d\n", opts.databits);
printf("stopbits are : %d\n", opts.stopbits);
printf("escape is : C-%c\n", KEYC(opts.escape));
if ( opts.noescape ) {
printf("escape is : none\n");
} else {
printf("escape is : C-%c\n", KEYC(opts.escape));
}
printf("local echo is : %s\n", opts.lecho ? "yes" : "no");
printf("noinit is : %s\n", opts.noinit ? "yes" : "no");
printf("noreset is : %s\n", opts.noreset ? "yes" : "no");