From df5d4cd033167c775fd69692446a146fe3453a0f Mon Sep 17 00:00:00 2001 From: Oleg Evseev Date: Fri, 13 Mar 2020 22:54:18 +0000 Subject: [PATCH] system/cu/cu_main.c: Add option -f to loop forever. --- system/cu/cu_main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/system/cu/cu_main.c b/system/cu/cu_main.c index 2c91d427c..4e59ad4cc 100644 --- a/system/cu/cu_main.c +++ b/system/cu/cu_main.c @@ -225,6 +225,7 @@ static void print_help(void) " -o: Set odd parity\n" " -s: Use given speed (default %d)\n" " -r: Disable RTS/CTS flow control (default: on)\n" + " -f: Enable endless mode without escape sequence (default: off)\n" " -?: This help\n", CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE, CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD); @@ -274,6 +275,7 @@ int main(int argc, FAR char *argv[]) int baudrate = CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD; enum parity_mode parity = PARITY_NONE; int rtscts = 1; + int nobreak = 0; int option; int ret; int bcmd; @@ -291,7 +293,7 @@ int main(int argc, FAR char *argv[]) sigaction(SIGKILL, &sa, NULL); optind = 0; /* global that needs to be reset in FLAT mode */ - while ((option = getopt(argc, argv, "l:s:ehor?")) != ERROR) + while ((option = getopt(argc, argv, "l:s:efhor?")) != ERROR) { switch (option) { @@ -315,6 +317,10 @@ int main(int argc, FAR char *argv[]) rtscts = 0; break; + case 'f': + nobreak = 1; + break; + case 'h': case '?': print_help(); @@ -377,6 +383,12 @@ int main(int argc, FAR char *argv[]) { int ch = getc(stdin); + if (nobreak == 1) + { + write(g_cu.outfd, &ch, 1); + continue; + } + if (ch <= 0) { continue;