mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2024-11-15 17:40:56 +00:00
get new len from strcspn
remove reset input buffer
This commit is contained in:
parent
a719af8265
commit
955edb781c
@ -266,12 +266,11 @@ static void interactive(PT_VMR vmr, bool with_prompt)
|
|||||||
printf(">> ");
|
printf(">> ");
|
||||||
while (fgets(input, MAX_LINE, stdin) != NULL)
|
while (fgets(input, MAX_LINE, stdin) != NULL)
|
||||||
{
|
{
|
||||||
input[strcspn(input, "\n")] = 0;
|
input[(len = strcspn(input, "\n"))] = 0;
|
||||||
if ((len = strlen(input)) == 1 && toupper(input[0]) == 'Q')
|
if (len == 1 && toupper(input[0]) == 'Q')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
parse_input(vmr, input);
|
parse_input(vmr, input);
|
||||||
memset(input, 0, len); /* reset input buffer */
|
|
||||||
|
|
||||||
if (with_prompt)
|
if (with_prompt)
|
||||||
printf(">> ");
|
printf(">> ");
|
||||||
|
Loading…
Reference in New Issue
Block a user