system/cu/cu_main.c: Add option -f to loop forever.

This commit is contained in:
Oleg Evseev 2020-03-13 22:54:18 +00:00 committed by patacongo
parent f221d33525
commit df5d4cd033

View File

@ -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;