mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2025-01-18 00:31:09 +00:00
increase input buffer size
when resetting buffer, clear only bits written to
This commit is contained in:
parent
a05b029e9d
commit
25692a9f35
4
.gitignore
vendored
4
.gitignore
vendored
@ -51,4 +51,6 @@ Module.symvers
|
|||||||
Mkfile.old
|
Mkfile.old
|
||||||
dkms.conf
|
dkms.conf
|
||||||
|
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
test*
|
10
src/vmrcli.c
10
src/vmrcli.c
@ -32,7 +32,8 @@
|
|||||||
"\tm: Launch the MacroButtons application\n" \
|
"\tm: Launch the MacroButtons application\n" \
|
||||||
"\ts: Launch the StreamerView application"
|
"\ts: Launch the StreamerView application"
|
||||||
#define OPTSTR ":hk:msc:iID:v"
|
#define OPTSTR ":hk:msc:iID:v"
|
||||||
#define MAX_LINE 512
|
#define MAX_LINE 4096 /* Size of the input buffer */
|
||||||
|
#define RES_SZ 512 /* Size of the buffer passed to VBVMR_SetParameterStringA */
|
||||||
#define COUNT_OF(x) (sizeof(x) / sizeof(x[0]))
|
#define COUNT_OF(x) (sizeof(x) / sizeof(x[0]))
|
||||||
#define DELIMITERS " \t;,"
|
#define DELIMITERS " \t;,"
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ struct result
|
|||||||
union val
|
union val
|
||||||
{
|
{
|
||||||
float f;
|
float f;
|
||||||
wchar_t s[MAX_LINE];
|
wchar_t s[RES_SZ];
|
||||||
} val;
|
} val;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -240,18 +241,19 @@ enum kind set_kind(char *kval)
|
|||||||
void interactive(PT_VMR vmr, bool with_prompt)
|
void interactive(PT_VMR vmr, bool with_prompt)
|
||||||
{
|
{
|
||||||
char input[MAX_LINE];
|
char input[MAX_LINE];
|
||||||
|
size_t len;
|
||||||
|
|
||||||
if (with_prompt)
|
if (with_prompt)
|
||||||
printf(">> ");
|
printf(">> ");
|
||||||
while (fgets(input, MAX_LINE, stdin) != NULL)
|
while (fgets(input, MAX_LINE, stdin) != NULL)
|
||||||
{
|
{
|
||||||
input[strcspn(input, "\n")] = 0;
|
input[strcspn(input, "\n")] = 0;
|
||||||
if (strlen(input) == 1 && toupper(input[0]) == 'Q')
|
if ((len = strlen(input)) == 1 && toupper(input[0]) == 'Q')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
parse_input(vmr, input);
|
parse_input(vmr, input);
|
||||||
|
memset(input, 0, len); /* reset input buffer */
|
||||||
|
|
||||||
memset(input, 0, MAX_LINE); /* reset input buffer */
|
|
||||||
if (with_prompt)
|
if (with_prompt)
|
||||||
printf(">> ");
|
printf(">> ");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user