get new len from strcspn

remove reset input buffer
This commit is contained in:
onyx-and-iris 2024-07-25 21:35:56 +01:00
parent a719af8265
commit 955edb781c

View File

@ -266,12 +266,11 @@ static void interactive(PT_VMR vmr, bool with_prompt)
printf(">> ");
while (fgets(input, MAX_LINE, stdin) != NULL)
{
input[strcspn(input, "\n")] = 0;
if ((len = strlen(input)) == 1 && toupper(input[0]) == 'Q')
input[(len = strcspn(input, "\n"))] = 0;
if (len == 1 && toupper(input[0]) == 'Q')
break;
parse_input(vmr, input);
memset(input, 0, len); /* reset input buffer */
if (with_prompt)
printf(">> ");