You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/03/13 22:36:14 UTC
[incubator-nuttx-apps] 02/03: system/cu/cu_main.c: Add option -f to
loop forever.
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit df5d4cd033167c775fd69692446a146fe3453a0f
Author: Oleg Evseev <ev...@gmail.com>
AuthorDate: Fri Mar 13 22:54:18 2020 +0000
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 2c91d42..4e59ad4 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;