apps/system/cu/cu_main.c: (1) Fix early exit. getc(stdin) can return 0 the first time around. (2) Set optind to zero. getopt() was being left in a bad state, causing parsing errors on second use. (3) Fix priority of cu_listen(). (4) Add suppor for -h.
This commit is contained in:
parent
de9101a1d9
commit
91276ba94e
@ -290,7 +290,8 @@ int main(int argc, FAR char *argv[])
|
|||||||
sa.sa_handler = sigint;
|
sa.sa_handler = sigint;
|
||||||
sigaction(SIGKILL, &sa, NULL);
|
sigaction(SIGKILL, &sa, NULL);
|
||||||
|
|
||||||
while ((option = getopt(argc, argv, "l:s:eor?")) != ERROR)
|
optind = 0; /* global that needs to be reset in FLAT mode */
|
||||||
|
while ((option = getopt(argc, argv, "l:s:ehor?")) != ERROR)
|
||||||
{
|
{
|
||||||
switch (option)
|
switch (option)
|
||||||
{
|
{
|
||||||
@ -314,6 +315,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
rtscts = 0;
|
rtscts = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'h':
|
||||||
case '?':
|
case '?':
|
||||||
print_help();
|
print_help();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
@ -357,6 +359,10 @@ int main(int argc, FAR char *argv[])
|
|||||||
goto errout_with_fds;
|
goto errout_with_fds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set priority of listener to configured value */
|
||||||
|
|
||||||
|
attr.priority = CONFIG_SYSTEM_CUTERM_PRIORITY;
|
||||||
|
|
||||||
ret = pthread_create(&g_cu.listener, &attr,
|
ret = pthread_create(&g_cu.listener, &attr,
|
||||||
cu_listener, (pthread_addr_t)0);
|
cu_listener, (pthread_addr_t)0);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
@ -373,7 +379,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
|
|
||||||
if (ch <= 0)
|
if (ch <= 0)
|
||||||
{
|
{
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start_of_line == 1 && ch == '~')
|
if (start_of_line == 1 && ch == '~')
|
||||||
|
Loading…
Reference in New Issue
Block a user